@kreftforeningen/web-react
v1.0.14
Published
A modern, accessible, and customizable React component library built with [Radix UI](https://www.radix-ui.com/) and [Vite](https://vitejs.dev/), powered by Kreftforeningen design tokens. Perfect for building beautiful, production-ready UIs with speed and
Downloads
591
Readme
@kreftforeningen/web-react
A modern, accessible, and customizable React component library built with Radix UI and Vite, powered by Kreftforeningen design tokens. Perfect for building beautiful, production-ready UIs with speed and consistency.
Features
- Accessible: Built on top of Radix UI primitives for accessibility out of the box.
- Customizable: Override styles with CSS variables and design tokens.
- Comprehensive: Includes Accordions, Alerts, Badges, Buttons, Cards, Carousels, Dropdowns, Forms, Tables, Tooltips, and more.
- Type-safe: Written in TypeScript with full type definitions.
- Fast: Powered by Vite for instant HMR and fast builds.
Installation
pnpm add @kreftforeningen/web-react
Usage
Import components directly from the library:
import {
Button,
Card,
Badge,
Accordion,
Alert,
// ...and more
} from "@kreftforeningen/web-react";Example:
import { Button, Card, Badge } from "@kreftforeningen/web-react";
function Example() {
return (
<Card>
<Badge>New</Badge>
<h2>Card Title</h2>
<Button>Click me</Button>
</Card>
);
}Components
- Accordion, Alert, AlertDialog, AspectRatio, Avatar, Badge, Breadcrumb, Button, Calendar, Card, Carousel, Checkbox, Collapsible, Command, ContextMenu, Dialog, Drawer, DropdownMenu, HoverCard, Input, InputOTP, Label, Menubar, NavigationMenu, Pagination, Popover, Progress, RadioGroup, Resizable, ScrollArea, Select, Separator, Sheet, Sidebar, Skeleton, Slider, Switch, Table, Tabs, Textarea, Toaster, Toggle, ToggleGroup, Tooltip, and more.
See the source code for a full list of exports.
Theming
All components rely on CSS custom properties (the --kf-* tokens) and authored styles.
You can override styles using the className prop, extend the provided variables, or supply your own tokens.
Development
Scripts
pnpm dev– Start the development serverpnpm build– Build the library for productionpnpm lint– Lint the source codepnpm check-types– Type-check the codebasepnpm test– Run tests
Requirements
- Node.js 18+
- pnpm
Daily Development
This project uses a straightforward feature-branch workflow. Branch off main, do the work, and merge back into main. Every push to main runs the release workflow and publishes to npm.
Development Workflow
Start from
maingit checkout main git pull origin mainCreate a branch for your work
git checkout -b feature/new-component # or: git checkout -b fix/button-stylingImplement changes and push
# edit files... git add . git commit -m "Implement feature" git push -u origin HEADMerge the branch locally (no PR workflow):
git checkout main git pull origin main git merge feature/new-component # or your branch namePrepare the release commit on
main(manual version bump):git checkout main git pull origin main # update package.json version by hand pnpm install --lockfile-only --ignore-scripts git add package.json pnpm-lock.yaml git commit -m "chore: release vX.Y.Z" git push origin mainThe
ReleaseGitHub Action runs automatically on every push tomainand publishes the package to npm.
Notes:
package.jsonhas apackageManagerfield. Runcorepack enablelocally to use the pinned pnpm version.- Prefer regenerating the lockfile over manual conflict resolution.
Branch Strategy
main- Source of truth & release branchfeature/*- Feature development branchesfix/*- Bug fix branchesdocs/*- Documentation update branches
Contributing
- Fork the repo and create your branch.
- Run
pnpm installto install dependencies. - Run
pnpm devto start the playground. - Submit a pull request!
License
MIT
Author
Asbjørn Ness, Kreftforeningen.
