@seda-protocol/ui
v0.1.0
Published
Reusable React design system with shared components, CSS variables, and utilities for SEDA UIs
Readme
@seda-protocol/ui
Internal React component library for SEDA applications.
@seda-protocol/ui provides shared UI components, global styling, and CSS-variable theme tokens for building consistent product interfaces across SEDA apps.
Usage
bun add @seda-protocol/uiQuick start
@seda-protocol/ui exposes compiled CSS and CSS-variable token entrypoints for consumers.
1. Import base styles
In your application entrypoint, or from your app stylesheet:
import "@seda-protocol/ui/styles.css";This applies the full design system base layer, including CSS variables for shadcn components.
For Tailwind v4 consumers, import the theme overrides from your Tailwind CSS entrypoint:
@import "@seda-protocol/ui/styles.css";
@import "@seda-protocol/ui/styles/tailwind-theme.css";
@import "@seda-protocol/ui/styles/shadcn-theme.css";
@import "tailwindcss/utilities.css";The overrides expose SEDA tokens as Tailwind utilities such as bg-background, text-h1, rounded-sm, and max-tablet.
2. Use components
import { Button } from "@seda-protocol/ui";
export function App() {
return <Button>Click me</Button>;
}3. Set theme
@seda-protocol/ui requires a data-theme attribute on <body>:
<body data-theme="light">or
<body data-theme="dark">Components
Import components from the package entrypoint:
import { Button } from "@seda-protocol/ui";Styles
@seda-protocol/ui exposes multiple styling entrypoints depending on how the consuming app is set up.
Compiled CSS (recommended)
import "@seda-protocol/ui/styles.css";- Applies full global/base styling
- Includes resets, themes, typography, shadcn CSS variables, and generated Tailwind utilities
- Recommended for apps that want a single CSS import
CSS tokens only
@import "@seda-protocol/ui/styles/tokens.css";
.example {
padding: var(--space-8);
color: var(--light-green-500);
}Use this when you only need design foundations without the global styling layer.
Provides:
- palettes
- spacing
- sizing
- typography variables
- breakpoints
- shapes
- transitions
- blur tokens
Specific CSS modules
@import "@seda-protocol/ui/styles/spacings.css";
@import "@seda-protocol/ui/styles/light-palette.css";
@import "@seda-protocol/ui/styles/themes.css";
@import "@seda-protocol/ui/styles/tailwind-theme.css";
@import "@seda-protocol/ui/styles/shadcn-theme.css";Use for targeted imports when full base styles or tokens are not needed.
Requirements
Theme
Components require a data-theme attribute on <body> so that CSS variables resolve correctly.
shadcn-compatible components use the CSS variables from @seda-protocol/ui/styles.css and support dark mode through body[data-theme="dark"].
Development
This section is for maintainers.
Scripts
scripts/fix-package-types.mjs
Removes style imports from emitted type definitions.scripts/copy-package-assets.mjs
Copies CSS style files and font assets intodistfor publishing.
Build and pack
bun run packBuilds the package, copies CSS/font assets into dist, and outputs a tarball in artifacts/.
Local validation
bun run example:devThis packs the library, reinstalls the generated tarball in the example app, and starts the example Vite dev server.
Package structure
The repository is split between library source, Storybook content, packaging helpers, and the example consumer app.
src/index.tsPublic library entrypoint. Exports the React components, icons, and public types that consumers import from@seda-protocol/ui.src/components/Library components. Most components live in their own folder with:component.tsxfor behavior and public propscomponent.stories.tsxfor Storybook coverage when that component has dedicated stories
src/styles/Shared CSS foundations and global styling layers. This includes palettes, spacing, breakpoints, typography, transitions, theme variable definitions, and the publishedbase.cssandtokens.cssentrypoints.src/res/icons/React icon components exported by the package.src/res/fonts/Font assets copied intodistso the published package can load the same typography assets.scripts/Packaging-only helpers used during the build flow.example/Consumer smoke-test app. It installs the packed tarball and verifies that component imports, CSS styles, Tailwind utility generation, and theme setup work from the published artifact.dist/Generated publish output. Contains built JS, emitted type definitions, compiled CSS, copied CSS style files, and copied font assets.
Styling layers
src/styles/base.cssFull global styling layer. Composes resets, global rules, fonts, theme variables, typography, spacing, shapes, and transitions.src/styles/tokens.cssReusable foundation barrel for apps that want CSS variables without importing the full global layer. The following modules are intentionally not included intokens.cssbecause they produce side-effects:fonts.cssthemes.css
Project Decisions
This project uses ADRs to keep track of impactful decisions that were made in the project. The aim is to make it easier for others to onboard later and understand what reasoning went into the choices that were made.
All decision records can be found in the docs/decisions directory.
Committing
This project expects commits to adhere to the conventional-commits standard. In order to help enforce this commitlint and husky are used to verify the message on commit.
