Using CSS Variables
Customise elements to match your dApps styles.
Default Themes
We're using CSS Variables, aka CSS Custom Properties for the theming system. We ship a light
and a dark
mode.
For the styles to appear please add leap-ui
class to a parent element of any component you use.
For the theme to be applied, you will need to add leap-ui
class to a parent element. And to use the dark mode, you'll have to add dark
class to the same parent element. Here's an example
Customisation
The default themes are great starters, however we give you complete control over the theme. However for most dApps, changing a few theme variables is enough. Let's say we're integrating the swaps modal on the stride app, here's the variables I would change
Find the full theme for stride and other dApps here - https://git.new/elements-themes
Let's compare the default light theme and the stride light theme
If you want the UI to look exactly like your dApp, here's all the CSS custom properties that you can modify with their descriptions
Troubleshooting Common Issues
>>> The default styles for elements are not coming up
It's most likely because you haven't added the following CSS import to your app
>>> I have customised the CSS variables, but it doesn't change the theme
This happens due to the cascading nature of CSS. Here's a few solutions (in-order) you should try
#1 Import your customisation styles after element's stylesheets
#2 Add an additional selector to the customisations block
Last updated