Skip to content
Nacre
Color palette
中文

Quick start

Import components into the app, apply a theme, build a first screen; and the rules for changing the library.

Clone the Nacre repository next to the application. From the application directory, add it as a local dependency and import components by package name.

Terminal window
git clone https://github.com/Lemenxzy/nacre ../nacre
nsh add --path ../nacre
import { Button, Dialog, TextField } from 'nacre'

Chat and call components are available from nacre/chat and nacre/call.

Set "theme": "theme.json" in the application’s nsh.json. From the application directory, generate the theme.

Terminal window
node ../nacre/theme/theme-import.ts --app .
node ../nacre/theme/theme-import.ts --app . --check

Use semantic tokens such as bg-background and text-muted-foreground. Override brand colors in the application’s themes/app.json.

import { View, signal } from 'nsh'
import { Button, Field, TextField } from 'nacre'
export function RemarkForm() {
const remark = signal('')
return (
<View class="gap-3">
<Field label="Remark" required>
<TextField value={remark()} onChange={(v) => remark.set(v)} accessibilityLabel="Remark" />
</Field>
<Button variant="primary" disabled={!remark().trim()}>Save</Button>
</View>
)
}

NSH is not React: a component function runs once, and signal / computed / effect update it afterwards; read props as props.x in JSX, since destructuring loses reactivity.

  • A new component first gets examples and a docs page (packages/ui/docs/pages/<key>.ts + <key>.examples.tsx), then tests (packages/ui/example/tests/<key>.test.tsx, starting with // covers:).
  • Then run:
Terminal window
node packages/ui/scripts/ui-exports.ts --check # export manifest and test coverage
node packages/ui/scripts/ui-api.ts # API tables
node packages/ui/scripts/ui-docs.ts # docs Markdown and llms.txt
node packages/ui/scripts/ui-mcp.selftest.ts # the MCP server reads complete data
nsh test packages/ui/example/tests/<key>.test.tsx