Composite UI is a design system first component library. This means all ui elements are intended to be controlled by the theme you provide using the
ThemeProvider
To create your own theme object you simply need to follow the System UI structure. If you are using Typescript, then simply define your theme object using the
ITheme
composite-ui
Alternatively, Composite UI provides a default theme out of the box that you can start using right away or modify/customize in any way you see fit. Below is a reference for what the default theme includes.
The Composite UI color scheme is intentionally simple, consisting only of different shades of white, gray, and black. A color system is one of the most imporant parts of defining and application or product, and Composite UI wants to make no assumptions about the application that uses it.
Primary
#212121
Secondary
#424242
Light
#757575
Primary
#fff
Secondary
#F4F5F6
0
#757575
1
#D9DBDC
2
#EEF0F2
3
#F4F5F6
4
#FAFAFB
There are a lot of different ways to structure your theme's color scheme. Often times it is useful to have fields oriented around usecase such as
text
background
Hello world
For additional colors you can have extra keys for each kind of color in your application. In the Composite UI theme, we have kept things simple and use arrays for each set of colors. These can then be referenced in code with dot notation like
color="gray.3"
A more complex color system will often prefer to have color palettes that have saturation levels for each color ranging from 10 to 900. These colors are then referenced by their saturation level, such as
gray.20
gray.50
const theme = {// ...colors: {gray: {// ...40: '#F4F5F6',// ...300: '#D9DBDC'// ...}}}
You can then reference these colors in code by saying
color="gray.40"
const theme = {shadow: ['none','0px 1px 5px rgba(0,0,0,0.12)','0px 3px 10px rgba(0,0,0,0.06)'];// ...}
const theme = {fonts: {body: `-apple-system,BlinkMacSystemFont,'Segoe UI','Oxygen','Ubuntu','Cantarell','Fira Sans','Droid Sans','Helvetica Neue',sans-serif`,},fontSizes:[12, 14, 16, 20, 24, 32, 48, 64, 72]}
const theme = {space: [0, 4, 8, 16, 32, 64, 128, 256, 512],// ...}