Liquid Glass
A distinct floating layer for navigation and controls.
Installation
bunx --bun shadcn@latest add https://apple-ui-eduardo.vercel.app/r/glass.jsonThe registry includes the shared styles and dependencies. Import @/components/apple-ui/styles.css in your root layout once. For the package route, use the installation guide.
Usage
<Glass variant="regular" shape="capsule" interactive>
<PlaybackControls />
</Glass>
<Glass variant="clear" dimmed>
<MediaControls />
</Glass>Package imports use @eduardoul/apple-ui. Registry imports use @/components/apple-ui. Add "use client" to files that use state or event handlers.
API reference
| Property | Type | Default |
|---|---|---|
| variant | regular | clear | regular |
| shape | rounded | capsule | circle | rounded |
| tone | auto | light | dark | auto |
| tint | neutral | accent | neutral |
| interactive | boolean | false |
| dimmed | boolean | false |
Use className and style to customize the component. The package includes full TypeScript definitions for its supported element properties and refs.
Design guidance
- Reserve glass for controls and navigation. Use Material for layers within content.
- Regular glass protects legibility with blur and luminosity. Clear glass belongs above detailed media.
- Use dimmed for white controls over bright media. Avoid placing one glass layer inside another.
- CSS implements the supported web treatment. Native optical refraction and system vibrancy differ.
Accessibility
Provide a visible label or accessible name. Keep keyboard focus visible and check the example with your content at 200 percent zoom. Overlays use Radix for focus management and keyboard dismissal.
Library styles support reduced motion, reduced transparency, increased contrast and forced colors. Read the accessibility foundation for the checks your application still needs.