Getting Started
Customization
KubedConfigProvider
Provide the subject context objects, internationalization context, and custom color schemes. This must be used in the root directory of the application and can only be used once.
Usage
1import { KubedConfigProvider } from "@kubed/components";23<KubedConfigProvider themeType={'dark'} locale={'zh'}>4<App />5</KubedConfigProvider>;
Props
1interface Props {2/** your application **/3children: React.ReactNode;4/** Custom theme **/5themes?: Array<KubedTheme>;6/** Dark/light theme, or the name of a custom theme. **/7themeType?: string | 'dark' | 'light';8/** The current language,default support 'en', 'zh', 'zh-tw', 'es' **/9locale?: Locale;10/** extend your locals **/11extendLocales?: Record<Locale, ILocale>;12}
Custom theme
Pass the theme objects to the themes property to customize the theme, which will be merged with the default theme and used across all components.
1import { KubedConfigProvider, Button, themeUtils } from "@kubed/components"2function App() {3const customDarkTheme = themeUtils.createFromDark({4type: "customDark",5palette: {6accents_1: "#1098AD",7accents_2: "#3BC9DB",8},9})10const customLightTheme = themeUtils.createFromLight({11type: "customLight",12palette: {13accents_1: "#F76707",14accents_2: "#FFA94D",15},16})17const [themeType, setThemeType] = useState("customDark")18return (19<KubedConfigProvider20themes={[customDarkTheme, customLightTheme]}21themeType={themeType}22>23<Button24onClick={() => {25if (themeType === "customDark") {26setThemeType("customLight")27} else {28setThemeType("customDark")29}30}}31>32button33</Button>34</KubedConfigProvider>35)36}