Mixins / foldkit-mixins-ui
mixins-ui
Most component libraries leave you with two bad options: copy-paste templates into your codebase and maintain every accessibility fix yourself, or wrap opaque widgets whose styles and markup you fight with fragile CSS overrides.
foldkit-mixins-ui gives you ready-made, accessible widgets that you install as a package, style with theme tokens and recipes, and upgrade cleanly. Each widget renders accessible markup from your Foldkit Model, exposes named extension points so you can style or decorate parts without copying templates, and tree-shakes down to the widgets you import.
Browse every widget and its live variants in the component gallery, or tune colors, typography, spacing, and motion across all of them at once in the theme builder.
Install
pnpm add foldkit-mixins-uifoldkit, effect, foldkit-mixins, foldkit-primitives, and @foldkit/ui are peer dependencies. Add foldkit-bundle when you place stateful widgets with Bundles (State: fold it by hand, or place a Bundle).
A first button
This renders a Save button in the theme's accent look and sends a Saved Message when clicked:
import type { Html, HtmlBuilder } from 'foldkit/html'
import { defineMessageUnion } from 'foldkit/message'
import { Button, Recipes } from 'foldkit-mixins-ui'
const Message = defineMessageUnion({ Saved: {} })
type Message = typeof Message.Type
const SaveStyle = Recipes.Button.style({})
export const saveButton = (h: HtmlBuilder<Message>): Html =>
Button.view({ label: 'Save', style: SaveStyle, onClick: Message.Saved() }, h)Button.view renders a <button type="button" class="...">Save</button> styled with the theme's accent tone and solid variant. Clicking it sends Saved to your Foldkit update; pressing Enter or Space activates it with standard button keyboard behavior.
When to use something else
Use foldkit-mixins-ui when you want styled, accessible widgets from the catalog below, or when you already use @foldkit/ui and want reusable styling, ARIA attributes, or element-level behavior through its toView callback.
If you are building custom views from scratch rather than adapting a catalog widget, define extension points directly with foldkit-mixins and read Inside-out view composition or Authoring components.