Close
import { CloseButton } from "@senvenli/react/action";
export default function Example() {
return <CloseButton />;
}import { CloseButton } from "@senvenli/react/action";Examples
A specific name
When several close buttons share a view, each says what it closes.import { CloseButton } from "@senvenli/react/action";
import { Card, CardHeader } from "@senvenli/react/display";
export default function Example() {
return (
<div className="max-w-sm">
<Card variant="outline" density="compact">
<CardHeader title="Filters" subtitle="Status: paid" actions={<CloseButton aria-label="Close filters" />} />
</Card>
</div>
);
}Guidelines
When to use it
- Closing a surface that can be dismissed.
Use something else when
- The action does more than dismiss, or needs a visible label. Button
Accessibility
Built in
- Named "Close" from the component strings.
You provide
- A more specific
labelwhen several close buttons share a view.
API reference
CloseButton
| Prop | Type | Default | Description |
|---|---|---|---|
radius | ComponentRadius | – | Corner radius: |
tone | ButtonTone | – |
|
fullWidth | boolean | – | As wide as its container (a form's submit on a phone, a stacked set of actions). |
size | ButtonSize | "small" | |
aria-label | string | – | Overrides the localized "Close" name. |
radiusComponentRadiusCorner radius:
none,small,medium(the design),largeorfull(a pill). The provider's default otherwise.toneButtonTonedangerfor a destructive action (delete, discard); it keeps the variant's shape.fullWidthbooleanAs wide as its container (a form's submit on a phone, a stacked set of actions).
sizeButtonSizeDefault"small"aria-labelstringOverrides the localized "Close" name.
Also takes 83 standard DOM and ARIA attributes (id, aria-label, event handlers…).