Fieldset
A native fieldset element with an easily stylable legend.
Partly measured from Geist's Fieldset. No reference has been captured yet.
import { Field, Fieldset } from "@replicas/ui";
export default function FieldsetDemo() {
return (
<Fieldset.Root style={{ width: 300 }}>
<Fieldset.Legend>Team details</Fieldset.Legend>
<Field.Root>
<Field.Label>Name</Field.Label>
<Field.Control defaultValue="Marketing" />
</Field.Root>
<Field.Root>
<Field.Label>Handle</Field.Label>
<Field.Control defaultValue="marketing" />
<Field.Description>Used in links like example.com/marketing.</Field.Description>
</Field.Root>
</Fieldset.Root>
);
}Prompt
Copy Prompt hands your agent everything it needs to build the Fieldset in the Geist style: the measured tokens, the CSS and the structure.
Show Prompt
# Geist Fieldset
A native fieldset element with an easily stylable legend.
Build a Fieldset 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/fieldset) if it has none.
Fidelity: Partly measured from Geist's Fieldset. No reference has been captured yet.
## Tokens
| Token | Light | Dark |
| --- | --- | --- |
| `--ds-background-100` | `hsl(0 0% 100%)` | `hsl(0 0% 4%)` |
| `--ds-background-200` | `hsl(0 0% 98%)` | `hsl(0 0% 0%)` |
| `--ds-gray-700` | `hsl(0 0% 56%)` | `hsl(0 0% 56%)` |
| `--ds-gray-1000` | `hsl(0 0% 9%)` | `hsl(0 0% 93%)` |
| `--ds-gray-alpha-400` | `#00000014` | `#ffffff24` |
| `--font-weight-semibold` | `600` | `600` |
## 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-fieldset {
box-sizing: border-box;
display: flex;
flex-direction: column;
gap: 16px;
min-width: 0;
margin: 0;
padding: 20px;
border: none;
border-radius: 6px;
background-color: var(--ds-background-100);
box-shadow:
0 0 0 1px var(--ds-gray-alpha-400),
0 0 0 1px var(--ds-background-200);
}
.ui-fieldset-legend {
padding: 0 0 4px;
font-size: 1.25rem;
font-weight: var(--font-weight-semibold);
letter-spacing: -0.4px;
line-height: 26px;
color: var(--ds-gray-1000);
&[data-disabled] {
color: var(--ds-gray-700);
}
}
}
```
## Structure
How Replicas assembles it on Base UI.
```tsx
import { Fieldset as BaseFieldset } from "@base-ui/react/fieldset";
const join = (base: string, extra?: string) => (extra ? `${base} ${extra}` : base);
function Root({ className, ...props }: Omit<BaseFieldset.Root.Props, "className"> & { className?: string }) {
return <BaseFieldset.Root className={join("ui-fieldset", className)} {...props} />;
}
function Legend({ className, ...props }: Omit<BaseFieldset.Legend.Props, "className"> & { className?: string }) {
return <BaseFieldset.Legend className={join("ui-fieldset-legend", className)} {...props} />;
}
export const Fieldset = {
Root,
Legend,
};
```
## Example
```tsx
import { Field, Fieldset } from "@replicas/ui";
export default function FieldsetDemo() {
return (
<Fieldset.Root style={{ width: 300 }}>
<Fieldset.Legend>Team details</Fieldset.Legend>
<Field.Root>
<Field.Label>Name</Field.Label>
<Field.Control defaultValue="Marketing" />
</Field.Root>
<Field.Root>
<Field.Label>Handle</Field.Label>
<Field.Control defaultValue="marketing" />
<Field.Description>Used in links like example.com/marketing.</Field.Description>
</Field.Root>
</Fieldset.Root>
);
}
```
## Foundations
The rest of the Geist style, as a skill: https://replicas.raphaelsalaja.com/skills/geist/SKILL.md