Glass
A translucent variant of Button, Tooltip, Popover, Menu, Context Menu and Card for surfaces over a picture.
Glass is a variant of the components on this page, not a component of its own. Set variant="glass" and the surface shows a darkened, blurred view of what lies behind it, with light text. It looks the same in Light and Dark. Shape, spacing, states and motion stay those of the component.
Glass needs something behind it. Use it over a photo, a video, a map or a color surface; on a plain page it shows almost nothing, so keep the default surface there. The gradient in these examples only makes the glass visible. It is not part of any component.
Installation
Glass comes with each component. To install every component on this page together with what its example uses:
pnpm dlx shadcn@4.18.0 add @siteplane/button @siteplane/tooltip @siteplane/popover @siteplane/menu @siteplane/context-menu @siteplane/card @siteplane/label @siteplane/switchButton
Install and API: Button.
The gradient only makes the glass visible. It is not part of the component.
Tooltip
Install and API: Tooltip.
The gradient only makes the glass visible. It is not part of the component.
Popover
Install and API: Popover.
The gradient only makes the glass visible. It is not part of the component.
Menu
Install and API: Menu. Dropdown Menu takes the same variant on DropdownMenuContent.
The gradient only makes the glass visible. It is not part of the component.
Context Menu
Install and API: Context Menu.
The gradient only makes the glass visible. It is not part of the component.
Card
Install and API: Card.
The gradient only makes the glass visible. It is not part of the component.
Card and text
Glass is a dark card with light text by default. It reads on dark and colorful backgrounds and on most light ones. Secondary text and icons take shares of the text color, and destructive items use the lighter red of Dark.
For a lighter card, set data-glass-tone="light". For dark text, set data-glass-ink="dark". Set them on a glass component, or on any element to change every glass component inside it. A popup renders outside its trigger, so set them on the popup itself.
<section data-glass-tone="light" data-glass-ink="dark">
<Card variant="glass">…</Card>
</section>
<MenuPopup data-glass-tone="light" data-glass-ink="dark" variant="glass">
…
</MenuPopup>How well text reads still depends on what lies behind the glass. Check the contrast on your own content, especially on very light pictures, and keep longer text on the default surface.