A super dummy set of design system primitives
- Install the
ui
package
npm install baka-ui
- Install the a
design
package
npm install baka-material-you
import { BakaButton } from "baka-ui";
import "baka-material-you/dist/index.css";
const App = () => <BakaButton>Click me</BakaButton>;
BakaUI embraces a Less is more
philosophy. It provides a set of design system primitives which can be used to build complex UIs by following simple guidelines. Here are some of the features of baka-ui
you can utilize to build your Design System.
UI is composed from multiple atomic components to achieve more-complex designs.
<BakaTextField>
<BakaLabel>Label</BakaLabel>
<BakaInput />
<BakaButton>
<BakaIcon>search</BakaIcon>
</BakaButton>
</BakaTextField>
Change the appearance of the components using themes & swatches by utilizing css & scss variables.
@use "baka-material-you" as material-you;
@use "baka-material-you/themes/dark" as dark-swatch;
:root {
@include materila-you.styles();
@media screen and (prefers-color-scheme: dark) {
@include dark-swatch.design-styles();
}
}
BakaUI semlessly integrates with TailwindCSS by providing a preset which can be used to extend the default TailwindCSS configuration and provide costitent look & feel between component-level & layout styles.
// tailwind.config.js
module.exports = {
// ...
presets: [require("baka-material-you/tailwind")],
};
Apply contextual typings according to your design system.
// The `variant` prop is typed according to the design system in use
<BakaButton variant={["filled", "icon"]}>Click me</BakaButton>
The baka-ui
is built on top of basic design system principles which are followed strictly.
Each design system is built by extracting common modules from it. For example, the baka-material-you
design system exposes the following modules:
colors
typography
iconography
elevation
layout
motion
Each component renders a exactly one polymorphic element. UI is composed from multiple atomic components to achieve more-complex designs.
<BakaTextField>
<BakaTextField>
<BakaLabel>Label</BakaLabel>
<BakaInput />
<BakaButton>
<BakaIcon>search</BakaIcon>
</BakaButton>
</BakaTextField>
Each component has a set of variants which can be used to change the appearance of the component.
<BakaButton variant="filled">Click me</BakaButton>
<BakaButton variant="text">Click me</BakaButton>
<BakaButton variant="outlined">Click me</BakaButton>
Variants can be combined to create more complex components.
<BakaButton variant={["filled", "icon"]}>Click me</BakaButton>
Each component has a set of states which can be used to change the appearance of the component based on the state.
<BakaButton hovered={true}>Hovered</BakaButton>
<BakaButton selected={true}>Selected</BakaButton>
<BakaButton activated={true}>Pressed</BakaButton>