Skip to content
Page

Checkbox

Binary choice with an optional label and description.

import { Checkbox } from "@pelagornis/page/components";

The preview above renders this file. Copy it into src/components/ to start from it.

src/components/CheckboxExample.tsx
import { useState } from "react";
import { Checkbox, Stack } from "@pelagornis/page/components";
export default function CheckboxDemo() {
const [notify, setNotify] = useState(true);
return (
<Stack gap="sizeSmall">
<Checkbox label="Accept terms and conditions" />
<Checkbox
label="Enable notifications"
description="Receive updates about releases"
checked={notify}
onChange={(event) => setNotify(event.target.checked)}
/>
<Checkbox variant="circular" label="Circular" defaultChecked />
<Checkbox label="Disabled" disabled />
</Stack>
);
}

Checkbox can be written straight in an .mdx page. Import it below the frontmatter. It renders on the server, so no client directive is needed.

src/content/docs/example.mdx
---
title: Example
---
import { Checkbox } from "@pelagornis/page/components";
<Checkbox label="Accept terms" description="Required to continue" />

pageMarkdoc() registers a checkbox tag for this component. Add the preset once in markdoc.config.mjs (see Use in Markdoc), then write the tag in any .mdoc page.

src/content/docs/example.mdoc
{% checkbox label="Accept terms" description="Required to continue" /%}

Attributes use the same names and values as the React props.

Values the component accepts for each variant prop.

PropValues
variantdefault circular

Parts of the component and the data-refineui role each one renders.

PartRole
rootcheckbox

Keys the component handles when it has focus.

KeyAction
Spaceactivate