Dashboard UI kit is developed in a friendly way towards CSS adjustments and theming. The core core componnets are styled with SCSS, which gives us the best control over the class naming. The components are developed with Bootstrap in mind - this doesn't mean that you need bootstrap to run the application, but if you are used to bootstrap, you can freerly use it (however it's not recommended to use the JS part of the Bootstrap). Here is how the DOM output look like.
// react <Button primary>Default</Button> // DOM <button class="btn btn-primary" type="button" role="button"> Default </button>
You don't need any stylesheet libraries, initialization is unnecessary and overriding styles is dead simple. To install the library, simple follow this guide. TLDR, install our kit, import styles and you are good to go!
As seen in the code above, the class naming is very straightforward and easy to work with. Many components share the same class naming as Bootstrap, but we have many custom components too.
The important fact is that during the development, we tried to reduce the CSS specificity to minimum. We worked with many libraries and sometimes it is really pain to style elements which look something like this:
.select .select-container.select-container__open .select-item.select-item__selected .icon
We hate it, you hate it and it's just a pain to style it. And because of that, we tried to reduce the specificity to maximum of 2. There might be some exception, but otherwise, we tried our best to deliver the best developing experience.
This has been a big topic. We want to deliver an amazing experience for developers and this is no exception. We decided to leverage CSS Variables instead of complicated injects, stylesheets and other dependencies that require a lot of initialization.
Using CSS variables however comes with a cost. If you intent to support all browsers, it might be problematics, you can check the browser support here. Browser support can be resolved by adding css-var-ponyfill.
This cannot be easier. On the right part of the top bar, you can switch between light and dark theme. By default, light theme is enabled. We created a dark theme for you as well, this is how the code looks like:
body { --bg-main: #252529; --bg-base: #2c2c31; --border-color-base: #34343a; --border-color-main: #44444e; --border-color-highlight: #64646e; --text-base: #ccc; --text-main: #ddd; --text-tertiary: #666; }
With few lines of code, we changed the core appearence of the documentation, amazing isn't it? You can add this code into your CSS file or add it somewhere in the JSX with inline styles.
<style> body { --bg-main: #252529; ... } </style>
You can also override variables localy, for example navigation panel only.
.my-nav-panel { --bg-main: #252529; ... }
You can use your css variables like so
.my-class { color: var(--color-primary); }
Or you can import or Sass vars file (recommended) to make sure that your conde is consistent, which will output the code above.
@import '@duik/core/_vars.scss'; .my-class { color: $color-primary; }
Default Value | Colors | Sass Variable | Description |
---|---|---|---|
#38B249 | --green | $color-green | Green color |
#1665D8 | --blue | $color-blue | Blue color |
#6977FF | --indigo | $color-indigo | Indigo color |
#FACF55 | --yellow | $color-yellow | Yellow color |
#F6AB2F | --orange | $color-orange | Orange color |
#E6492D | --red | $color-red | Red color |
Default Value | Colors by domain | Sass Variable | Description |
#1665D8 | --primary | $color-primary | Primary (theme) color |
#38B249 | --success | $color-success | For displaying positive output or actions |
#F6AB2F | --warning | $color-warning | For displaying negative output or actions |
#E6492D | --danger | $color-danger | Displaying actions with an impact |
#6977FF | --info | $color-info | Informative color |
Default Value | Backgrounds | Sass Variable | Description |
#FFFFFF | --bg-base | $bg-base | Base background color for your content. |
#FBFBFD | --bg-main | $bg-main | Main background color for your content, which adds higher contrast. |
#252529 | --bg-adverse-main | $bg-adverse-main | Adverse color for the main background (e.g. white vs black) |
Default Value | Text Colors | Sass Variable | Description |
#3E3F42 | --text-main | $text-main | Main content color for the highest contrast, e.g. headlines. |
#6B6C6F | --text-base | $text-base | Base text color, recommended for paragraphs. |
#9EA0A5 | --text-secondary | $text-secondary | Secondary text color with less contrast, e.g. for less important typographic descriptions. |
#CECFD2 | --text-tertiary | $text-tertiary | Tertiary text color, e.g. for labels |
#FFFFFF | --text-on-color | $text-on-color | Color of a text that is used on the colored background. |
#FFFFFF | --text-adverse-main | $text-adverse-main | Same as text-main but adverse |
#FBFBFD | --text-adverse-base | $text-adverse-base | Same as text-base but adverse |
Default Value | Borders | Sass Variable | Description |
#EAEDF3 | --border-color-base | $border-color-base | Base border color with regular contrast, e.g. text inputs |
#D8DCE6 | --border-color-main | $border-color-main | Border color with higher contrast, e.g. for hover state |
#BDC2D1 | --border-color-highlight | $border-color-highlight | Border color with highest contrast |
#2E2E33 | --border-color-adverse | $border-color-adverse |