Customize
Integrate your style and design system into Lapikit components
By default, Lapikit is inspired by Material Design v3 style rules, so as to offer a coherent foundation that can be adapted to the widest possible audience. With Lapikit, you can quickly customize components using the lapikit.config.js file located at the root of your application.
Lapikit customization is divided into 4 main parts:
Breakpoints configuration manages responsive design behavior across different devices.
{[key: string]: number | string}
)Define device-specific breakpoints for responsive behavior:
breakpoints: {
devices: {
mobile: "sm",
tablet: "md",
laptop: "lg"
}
}
{[key: string]: number | string}
)Set the actual breakpoint values that correspond to your device keys:
breakpoints: {
thresholds: {
sm: "640px",
md: "768px",
lg: "1024px",
xl: "1280px"
}
}
Theme configuration handles color schemes and theme definitions.
string
)Set the default theme to be used by your application.
boolean
)Enable or disable automatic color scheme detection based on user preferences.
FragThemes
)Define your custom themes with colors and variables:
theme: {
themes: {
light: {
dark: false,
colors: {
primary: "#6750a4",
secondary: "#625b71"
},
variables: {
"custom-spacing": "8px"
}
},
dark: {
dark: true,
colors: {
primary: "#d0bcff",
secondary: "#ccc2dc"
}
}
}
}
Each theme can contain:
boolean
): Whether this is a dark theme{[key: string]: {[key: string]: string} | string}
): Color definitions{[key: string]: string | number}
): Custom CSS variablesTypography configuration manages font families and text styling.
string
)Set the default typography family to be used.
FragTypography
)Define custom font families:
typography: {
fonts: {
sans: {
family: ["Inter", "system-ui", "sans-serif"]
},
mono: {
family: "JetBrains Mono"
}
}
}
Global styling configuration for design tokens and variables.
FragStyles
)Define global styling variables that can be used throughout your application:
styles: {
spacing: "0.125rem",
radius: {
sm: "0.25rem",
md: "0.5rem",
lg: "1rem"
},
shadow: "0 1px 3px rgba(0, 0, 0, 0.1)"
}
Values can be strings, numbers, or nested objects for complex configurations.
Here’s a complete example of a lapikit.config.js file:
export default {
breakpoints: {
devices: {
mobile: "sm",
tablet: "md",
laptop: "lg",
},
thresholds: {
sm: "640px",
md: "768px",
lg: "1024px",
xl: "1280px",
},
},
theme: {
defaultTheme: "light",
colorScheme: true,
themes: {
light: {
dark: false,
colors: {
primary: "#6750a4",
secondary: "#625b71",
},
},
dark: {
dark: true,
colors: {
primary: "#d0bcff",
secondary: "#ccc2dc",
},
},
},
},
typography: {
defaultTypography: "sans",
fonts: {
sans: {
family: ["Inter", "system-ui", "sans-serif"],
},
},
},
styles: {
spacing: "0.125rem",
radius: {
sm: "0.25rem",
md: "0.5rem",
},
},
};
Lapikit provides a Vite plugin to automatically process your configuration and generate the necessary CSS files during the build process.
The next steps
See also the Breakpoints and Application pages to take full advantage of the visual possibilities.
Do you have a question? Ask on GitHub or Discord server
Do you see a bug? Open an issue on GitHub