# @xingxingmofashu/ui — Full documentation
> React components with a CSS-only Liquid Glass visual style, built with Tailwind CSS 4 and Tailwind Variants.
This file contains every English documentation page.
Use the URL line above each section to cite the canonical page.
## Introduction
URL: https://xingxingmofashu.github.io/ui/docs/en/get-started/introduction
@xingxingmofashu/ui is a collection of typed React components with a Liquid Glass visual style for React 19 and Tailwind CSS 4.
@xingxingmofashu/ui is at 0.2.x. APIs may change before 1.0; pin a version and review the [release notes](https://github.com/xingxingmofashu/ui/releases) when upgrading.
## What is @xingxingmofashu/ui?
`@xingxingmofashu/ui` is a React component library for building interfaces with a CSS-only Liquid Glass visual style. It ships twenty-five components across elements, forms, overlays, and feedback, and works in any React 19 application with Tailwind CSS 4.
Glass surfaces, rim highlights, inner shadows, and pressed states are drawn entirely with CSS. Interactive behavior is built into the components, while Tailwind Variants keeps the styling typed and composable.
If you are building a React project with Tailwind CSS and want a distinctive monochrome Liquid Glass aesthetic, `@xingxingmofashu/ui` is a good default choice. It provides high-level components such as Button, Card, Dialog, Drawer, and Toast while still allowing customization through `className`, `ui` slots keyed by `data-slot`, and the shared `--ui-*` tokens.
- Developer experience first: Intuitive component APIs, typed props, deep imports, and bilingual documentation.
- Beautiful by default: A monochrome Liquid Glass material that stays consistent across light and dark themes.
- Typed slots: Slot names and sizes derive from the Tailwind Variants recipe, so overrides stay checked.
- Focused surface area: Twenty-five carefully styled components instead of a sprawling catalog, with consistent sizing, naming, and visual language.
## Core technologies
`@xingxingmofashu/ui` is built on two foundations: Tailwind CSS for styling and Tailwind Variants for typed variants. Interactive behavior is built into each component.
- **CSS-first configuration**: theme tokens live in CSS
- **Modern web features**: `color-mix`, container units, `:has`, and individual transforms
- **Source scanning**: the package stylesheet scans its own component files, so no extra `@source` is required
- **Dynamic styling**: typed size and state variants
- **Type safety**: component props derive from the theme recipes
- **Conflict resolution**: `cn` merges Tailwind classes predictably
## Key features
### CSS-only glass material
The glass surface, rim highlight, inner shadow, and pressed thumb are all regular CSS. There is no canvas, WebGL, or image asset behind the material.
### Light and dark themes
Tokens switch through `.light` / `.dark` or `data-theme="light"` / `data-theme="dark"`. A nested light subtree can switch back even inside a dark application.
### Typed APIs
Component props, size variants, controlled state, and event details are typed. Deep imports are available for each component, composable, and theme recipe.
### Server-safe Card
`Card` is a native layout primitive that can render from a React Server Component. The interactive components are client components.
## FAQ
### Is the package free to use?
Yes. It is open source under the MIT license.
### Does it work with React 18?
No. The package targets React 19 and React DOM 19.
### Is Tailwind CSS required?
Yes. Tailwind CSS 4 is a peer dependency; the package stylesheet contains tokens and material classes, not a precompiled utility sheet.
### Is it production-ready?
The package is at 0.2.x. The components are tested and documented, but APIs may still change before 1.0. Pin a version and review the [release notes](https://github.com/xingxingmofashu/ui/releases) when upgrading.
### Does it include data tables, date pickers, or a command palette?
Not yet. The current release focuses on twenty-five core components: elements, form controls, overlays, and feedback. Additional components will ship in later releases.
### How does it handle accessibility?
Interactive components provide WAI-ARIA semantics, keyboard support, and focus management. Always test the complete interaction in your own application.
### Where can I get help?
Open an issue on [GitHub](https://github.com/xingxingmofashu/ui/issues) with a reproduction.
## Explore
- [Installation](/docs/en/get-started/installation): Add the package to a React project.
- [Button](/docs/en/components/button): Start with the core action component.
- [Toggle](/docs/en/components/toggle): See the pressed glass state.
---
## Installation
URL: https://xingxingmofashu.github.io/ui/docs/en/get-started/installation
Learn how to install and configure @xingxingmofashu/ui in a React application.
Requires React 19, React DOM 19, Tailwind CSS 4, and Node.js 22+.
## Setup
### Add to a React project
#### Install the package
pnpm
yarn
npm
bun
```bash
pnpm add @xingxingmofashu/ui
```
```bash
yarn add @xingxingmofashu/ui
```
```bash
npm install @xingxingmofashu/ui
```
```bash
bun add @xingxingmofashu/ui
```
#### Add the package styles
```css [app.css]
@import "tailwindcss";
@import "@xingxingmofashu/ui";
```
The package root resolves to `dist/index.css` through its `style` export. The stylesheet includes its own Tailwind source scan, so no extra `@source` directive is needed.
#### Import a component
```tsx
import { Button } from "@xingxingmofashu/ui";
export function Example() {
return ;
}
```
Deep imports are available for a single component or theme recipe:
```tsx
import { Button } from "@xingxingmofashu/ui/components/button";
import buttonTheme from "@xingxingmofashu/ui/theme/button";
```
## Requirements
- Node.js 22 or newer.
- React and React DOM 19.
- Tailwind CSS 4.
- An ESM-capable bundler. The package publishes ES modules only.
- A current evergreen browser with `backdrop-filter`, `color-mix`, container units, and `:has`.
`Card` is server-safe and can render from a React Server Component. The interactive components are client components.
## Theming
Light and dark tokens are selected by `.light` / `.dark`, or by `data-theme="light"` / `data-theme="dark"`:
```html [index.html]
```
or:
```html [index.html]
```
A nested `.light` / `[data-theme="light"]` subtree can switch back to light tokens. Shared colors and glass parameters live in the `--ui-*` tokens; override them in your own theme layer. Tailwind aliases use the `ui-` prefix (`text-ui-ink`, `outline-ui-glass-focus`, and so on) to avoid colliding with host tokens.
## Troubleshooting
Make sure the package stylesheet is imported from the same CSS entry that imports Tailwind:
```css [app.css]
@import "tailwindcss";
@import "@xingxingmofashu/ui";
```
The package stylesheet scans its own component files in `dist`, so you do not need to add a manual `@source` directive.
### React 18
The package targets React 19. Upgrade `react` and `react-dom` before installing `@xingxingmofashu/ui`.
## Next steps
- [Introduction](/docs/en/get-started/introduction): Learn what the library provides.
- [Button](/docs/en/components/button): Start with the core action component.
- [Toggle](/docs/en/components/toggle): See the pressed glass state.
---
## Guides
URL: https://xingxingmofashu.github.io/ui/docs/en/guides
Practical guides for theming, forms, accessibility, server rendering, and starter templates.
These guides cover the work that starts after installation: matching the glass
material to your brand, wiring components into real forms, shipping accessible
interactions, and rendering the library in a server-first application.
- [Theming](/docs/en/guides/theming): Override glass tokens, switch light and dark themes, and build custom glass surfaces.
- [Forms](/docs/en/guides/forms): Submit values, validate fields, and compose the form controls with native form semantics.
- [Accessibility](/docs/en/guides/accessibility): Understand labeling, keyboard behavior, focus management, and live-region support.
- [Server rendering](/docs/en/guides/ssr): Use the server-safe Card, create client islands, and avoid hydration surprises.
- [Templates](/docs/en/guides/templates): Start from the Vite starter or copy a Next.js settings and confirmation recipe.
## Before you start
Every guide assumes:
- React 19 and React DOM 19.
- Tailwind CSS 4 with `@import "@xingxingmofashu/ui";` in the global stylesheet.
- A current evergreen browser with `backdrop-filter`, `color-mix`, container
units, and `:has`.
If you have not installed the package yet, begin with
[Installation](/docs/en/get-started/installation). Component-level examples and
prop tables live under [Components](/docs/en/components).
---
## Theming
URL: https://xingxingmofashu.github.io/ui/docs/en/guides/theming
Customize the Liquid Glass material, light and dark tokens, and Tailwind aliases.
The core package ships one stylesheet that contains the design tokens, the
shared glass material, and the Tailwind source scan. Import it once in your
global CSS and style the rest of the application around it.
```css [app.css]
@import "tailwindcss";
@import "@xingxingmofashu/ui";
```
## Light and dark
Tokens switch through `.light` / `.dark` classes or
`data-theme="light"` / `data-theme="dark"` attributes. Light is the default even
when no selector is present.
```html [index.html]
```
```html [index.html]
```
The two mechanisms are interchangeable. A nested `.light` or
`[data-theme="light"]` subtree can switch back to light tokens inside a dark
document, which is useful for previews and isolated panels.
```html
...
```
Set the theme before the first paint when possible. Reading `localStorage`
during render causes a hydration mismatch; set the class in an inline script or
use a theme library such as `next-themes` with `suppressHydrationWarning` on the
`` element.
## Glass presets
Glass presets are an optional plugin, not part of the core stylesheet. The
plugin's stylesheet ships the `thin`, `soft`, `regular`, and `thick` materials,
and its React entry manages `data-glass` state and persistence.
See [Glass presets](/docs/en/plugins/glass-preset) for setup, preset values,
controlled state, scoped overrides, and SSR behavior.
## Token layers
The material is split into two layers:
- **Runtime tokens** change with the theme: `--ui-ink`, `--ui-ink-active`,
`--ui-surface`, `--ui-glass-surface`, `--ui-glass-overlay-surface`,
`--ui-glass-border`, `--ui-glass-highlight`, `--ui-glass-rim`,
`--ui-glass-focus`, `--ui-glass-inner-border`, `--ui-glass-tone`,
`--ui-glass-contrast`, `--ui-shadow-glass`, and `--ui-drop-shadow-label`.
- **Shared geometry and optics** stay stable across light and dark themes:
`--ui-glass-blur`, `--ui-glass-saturate`, `--ui-glass-inner-inset`,
`--ui-glass-rim-inset`, and the other shared `--ui-glass-*` parameters.
Presets may change blur and saturation. Component-specific values such as the
checkbox rim or slider lens stay in that component's theme recipe.
The package defines them inside `@layer theme`. An unlayered `:root` block in
your application therefore wins without an `!important`:
```css [app.css]
@import "tailwindcss";
@import "@xingxingmofashu/ui";
:root {
--ui-glass-surface: rgb(255 255 255 / 0.5);
--ui-glass-overlay-surface: rgb(255 255 255 / 0.8);
--ui-glass-border: rgb(15 23 42 / 0.16);
--ui-glass-blur: 20px;
--ui-glass-saturate: 160%;
}
.dark,
[data-theme="dark"] {
--ui-glass-surface: rgb(20 20 20 / 0.75);
--ui-glass-overlay-surface: rgb(20 20 20 / 0.86);
--ui-glass-border: rgb(255 255 255 / 0.24);
}
```
The default `thin` material pairs a 20% light veil or 62% dark veil with a
4px backdrop blur at 150% saturation. The veil strength balances transparency
against text contrast, so tune it for the imagery in your application: test over
the busiest and darkest background, not only over a plain page.
Text-bearing overlays—Dialog, Alert Dialog, Drawer, Popover, Menu, Select,
Toast, and Tooltip—use `.ui-glass-overlay` and the stronger
`--ui-glass-overlay-surface` veil (64% light / 76% dark by default). The page
stays visible through the panel while body copy gets a stronger base. The fill
still varies with the page behind it, so verify secondary text contrast over
your busiest imagery. The glass preset plugin adjusts both surface tokens.
Overlays no longer use `--ui-surface`: if you relied on that override for
overlay backgrounds, set `--ui-glass-overlay-surface` instead. Set both tokens
when opaque surfaces and overlays should move together.
## Tailwind aliases
The stylesheet exposes Tailwind color aliases for the most common tokens:
| Utility family | Token |
| --- | --- |
| `text-ui-ink`, `bg-ui-ink` | `--ui-ink` |
| `bg-ui-glass-surface` | `--ui-glass-surface` |
| `bg-ui-glass-overlay-surface` | `--ui-glass-overlay-surface` |
| `border-ui-glass-border` | `--ui-glass-border` |
| `outline-ui-glass-focus` | `--ui-glass-focus` |
| `bg-ui-surface` | `--ui-surface` |
Use these aliases for your own layout so custom chrome follows the same theme as
the components. Arbitrary values still work when you need a one-off:
```tsx
Matches the component material.
```
## Custom glass surfaces
The shared material is also exported as CSS classes. Combine them when you need
a glass panel that is not one of the shipped components:
```tsx
Custom glass panel
```
- `.ui-glass` draws the translucent fill, double border, specular shadow, and
backdrop blur.
- `.ui-glass-overlay` swaps the fill for the stronger overlay veil; use it for
text-bearing panels that float above page content.
- `.ui-glass-inner` adds the soft inner outline through `::before`.
- `.ui-glass-highlight` adds the diagonal glare through `::after`.
- `.ui-glass-rim` is a decorative child element; render it with
`aria-hidden="true"`.
- `.ui-glass-chip` is a compact surface for small readouts.
Most components already compose these classes. Use them directly only for
surfaces the package does not provide.
## Component-level styling
Every component accepts `className` and `style`. They merge into the
component's primary element: the root for most components, the popup for
Dialog, Alert Dialog, Drawer, Popover, Menu, and Tooltip, the outer root for
`Input`, the field root for `Select`, and each toast for `Toast`. Use them for
layout, not for replacing the material:
```tsx
```
Every component also accepts `ui`, an object keyed by the component's
`data-slot` names. Use it to style internal slots while keeping the
single-structure API:
```tsx
Build 128 is live.
```
Values are `ClassValue`, so strings, arrays, and class maps work. The merge
order is theme recipe, `ui`, then `className`; for collection components such as
Accordion and Toggle Group, root `ui` is applied first, then each item's `ui`,
then the item's `className`. Inspect the DOM `data-slot` attribute or the
component API table for the available keys.
Use `style` for values that must be computed at runtime, including per-instance
CSS variables. Inline styles override matching properties from the theme and
`className`; keep color, blur, and shadow changes on the shared tokens.
For full control, import a compiled theme recipe:
```tsx
import buttonTheme from "@xingxingmofashu/ui/theme/button";
const styles = buttonTheme({ size: "lg" });
export function CustomButton() {
return ;
}
```
The recipe returns slot classes, so a custom component can reuse the same
geometry and material without copying Tailwind classes.
## Motion and browser support
Transitions and pressed effects include `motion-reduce` variants. Users who set
`prefers-reduced-motion: reduce` keep the layout and state changes but lose the
decorative motion.
The visual material relies on modern CSS: `backdrop-filter`, `color-mix`,
container units, individual `translate` / `scale` properties, and `:has`.
Provide a sensible fallback background for browsers that do not support
`backdrop-filter`, or limit support to current evergreen browsers.
## Checklist
- Import the package stylesheet exactly once, before your own overrides.
- Set `.dark` or `data-theme="dark"` before first paint.
- Use the optional [glass preset plugin](/docs/en/plugins/glass-preset) for
`data-glass` materials.
- Override tokens in an unlayered `:root` and `.dark` block for custom material.
- Test glass contrast over the busiest background in the app.
- Prefer `ui` for internal slots, `className` and `style` for layout, and tokens for material changes.
---
## Forms
URL: https://xingxingmofashu.github.io/ui/docs/en/guides/forms
Submit values, validate fields, and compose accessible React forms with the Liquid Glass controls.
The form controls are designed to work with native `
```
## Submitted values
| Component | Submitted as | Empty state |
| --- | --- | --- |
| `Input` | Native input named by `name` | Empty string |
| `Checkbox` | Hidden checkbox with `name` and `value` | `null` when unchecked |
| `CheckboxGroup` | One hidden checkbox per checked value, all sharing `name` | No entries when nothing is checked |
| `Switch` | Hidden checkbox with `name` and `value` | `null` when off |
| `Select` | Hidden native input named by `name` with the selected value | `null` when nothing is selected |
| `Slider` | Hidden `input[type="range"]` named by `name` | Defaults to the current value |
| `RadioGroup` | Hidden radio named by `name` with the selected item value | `null` when nothing is selected |
`RadioGroup` submits the selected item's `value`; set `required` when a choice
is mandatory. `Select` behaves the same way: `name` enables submission,
`required` participates in native validation, and `form` links the hidden input
to a form elsewhere. A controlled `value` of `null` represents no selection.
`CheckboxGroup` submits one entry per checked value under the same `name`, so
read the field with `FormData.getAll(name)`. Groups have no native `required`;
validate that at least one value is present in your submit handler.
`Button` forwards `type` to its root button element. Set `type="submit"` when it should
submit the surrounding form.
```tsx
```
When handling submission in the client, read the values from `FormData`:
```tsx
function handleSubmit(event: React.FormEvent) {
event.preventDefault();
const data = new FormData(event.currentTarget);
const email = String(data.get("email") ?? "");
const channels = data.getAll("channels").map(String);
const notifications = data.get("notifications") !== null;
// Send the values to your API or update local state.
}
```
## Labels and descriptions
Use `Field` for text inputs, `Fieldset` for related groups, and the built-in
label props for the other controls:
- `Field` renders a real `