Quick start
Import components into the app, apply a theme, build a first screen; and the rules for changing the library.
Import
Section titled “Import”Clone the Nacre repository next to the application. From the application directory, add it as a local dependency and import components by package name.
git clone https://github.com/Lemenxzy/nacre ../nacrensh add --path ../nacreimport { 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.
node ../nacre/theme/theme-import.ts --app .node ../nacre/theme/theme-import.ts --app . --checkUse semantic tokens such as bg-background and text-muted-foreground. Override brand colors in the application’s themes/app.json.
A first screen
Section titled “A first screen”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.
Changing the library
Section titled “Changing the library”- 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:
node packages/ui/scripts/ui-exports.ts --check # export manifest and test coveragenode packages/ui/scripts/ui-api.ts # API tablesnode packages/ui/scripts/ui-docs.ts # docs Markdown and llms.txtnode packages/ui/scripts/ui-mcp.selftest.ts # the MCP server reads complete datansh test packages/ui/example/tests/<key>.test.tsx