Form
A native form element with consolidated error handling.
Derived from Geist's field spacing.
import { Button, Field, Form } from "@replicas/ui";
import { useState } from "react";
export default function FormDemo() {
const [created, setCreated] = useState<string | null>(null);
return (
<Form style={{ width: 300 }} onFormSubmit={(values) => setCreated(String(values.title))}>
<Field.Root name="title">
<Field.Label>Project name</Field.Label>
<Field.Control required placeholder="Website redesign" />
<Field.Error match="valueMissing">Add a name to create the project</Field.Error>
</Field.Root>
<Field.Root name="team">
<Field.Label>Team</Field.Label>
<Field.Control defaultValue="Marketing" />
</Field.Root>
<div style={{ display: "flex", alignItems: "center", gap: 8 }}>
{created ? <span style={{ flex: 1, color: "var(--text-tertiary)" }}>Created “{created}”</span> : null}
<Button type="submit" variant="primary" style={{ marginLeft: "auto" }}>
Create project
</Button>
</div>
</Form>
);
}Prompt
Copy Prompt hands your agent everything it needs to build the Form in the Geist style: the measured tokens, the CSS and the structure.
Show Prompt
# Geist Form
A native form element with consolidated error handling.
Build a Form in this project that looks and behaves like Geist's. Measured from the running Geist app (vercel.com/geist). Keep every value exact. Map the tokens onto the project's own theme variables instead of hard-coding them. Use the project's own component library for behaviour, or [Base UI](https://base-ui.com/react/components/form) if it has none.
Fidelity: Derived from Geist's field spacing.
## Tokens
None.
## CSS
Scoped under `[data-style="geist"]`; dark rules sit under `[data-theme="dark"]`. The `ui-*` classes and data attributes match the structure below.
```css
[data-style="geist"] {
.ui-form {
display: flex;
flex-direction: column;
gap: 16px;
}
}
```
## Structure
How Replicas assembles it on Base UI.
```tsx
import { Form as BaseForm } from "@base-ui/react/form";
export function Form({ className, ...props }: Omit<BaseForm.Props, "className"> & { className?: string }) {
return <BaseForm className={className ? `${"ui-form"} ${className}` : "ui-form"} {...props} />;
}
```
## Example
```tsx
import { Button, Field, Form } from "@replicas/ui";
import { useState } from "react";
export default function FormDemo() {
const [created, setCreated] = useState<string | null>(null);
return (
<Form style={{ width: 300 }} onFormSubmit={(values) => setCreated(String(values.title))}>
<Field.Root name="title">
<Field.Label>Project name</Field.Label>
<Field.Control required placeholder="Website redesign" />
<Field.Error match="valueMissing">Add a name to create the project</Field.Error>
</Field.Root>
<Field.Root name="team">
<Field.Label>Team</Field.Label>
<Field.Control defaultValue="Marketing" />
</Field.Root>
<div style={{ display: "flex", alignItems: "center", gap: 8 }}>
{created ? <span style={{ flex: 1, color: "var(--text-tertiary)" }}>Created “{created}”</span> : null}
<Button type="submit" variant="primary" style={{ marginLeft: "auto" }}>
Create project
</Button>
</div>
</Form>
);
}
```
## Foundations
The rest of the Geist style, as a skill: https://replicas.raphaelsalaja.com/skills/geist/SKILL.md