First component
@codeui/solid v0.3.0
Build a snippet export settings screen.
Build the screen
import { createSignal } from "solid-js";
import { Button, Stack, Text, TextField } from "@codeui/solid";
export default function ExportScreen() {
const [name, setName] = createSignal("Fetch example");
const [saved, setSaved] = createSignal(false);
return <Stack gap="4" style={{ padding: "var(--cui-space-4)", background: "var(--cui-surface-canvas)", "border-radius": "var(--cui-radius-card)", width: "100%", "max-width": "360px" }}>
<Text as="h2" size="md" weight="semibold">Export snippet</Text>
<TextField label="Snippet name" value={name()} onChange={value => { setName(value); setSaved(false); }} />
<Text size="xs" tone="muted">Save a PNG for your documentation.</Text>
<Stack direction="row"><Button variant="primary" disabled={!name().trim()} onClick={() => setSaved(true)}>Save export settings</Button></Stack>
<Text size="xs" tone="muted" role="status">{saved() ? `Settings saved for ${name()}.` : "Settings are ready to save."}</Text>
</Stack>;
}Copy the demo into your Solid app after installation. Render its default export from your app root. You see a snippet name, a description, a save action, and a status message.
Save the settings
Change the snippet name. Activate Save export settings. The status message includes the current name. Clear the name. The button becomes disabled until you enter a name again. This example saves local UI state. It does not create an image or send a request.
Change a token
Set --cui-surface-canvas on a parent of the screen in your app stylesheet. The recessed background changes without replacing any component classes.
Keep the page background lighter than the island in dark mode. Theming lists the token contract.
Check the result
| Key | Action |
|---|---|
| Tab | Moves between the name field and the enabled save button. |
| Enter or Space on the button | Saves the current settings. |
The field label provides its accessible name. The status region announces the saved message without moving focus. The screen renders its initial field, button, and message on the server. Solid hydrates the signal handlers in the browser. This screen has no portal.