Controls
Glass Button
A glass button with four variants, three sizes and an asChild mode for links.
Preview
Demos ready. Update 0.
The preview runs the React version. On iOS 26 and later, the React Native version uses the system’s own glass. See it on a phone.
Installation
For React 19+ apps with Tailwind CSS 4.
npx shadcn@4.14.1 add @glassyui/glass-buttonAdds 10 files to components/glassyui and installs @radix-ui/react-slot and clsx.
Usage
Usage
import { GlassButton } from "@/components/glassyui/glass-button";
export function ButtonDemo() {
return <GlassButton>Save changes</GlassButton>;
}React Native usage
import { useState } from 'react';
import { View } from 'react-native';
import { GlassButton } from '@/components/glassyui/glass-button';
export default function ButtonExample() {
const [saved, setSaved] = useState(false);
return (
<View style={{ flexDirection: 'row', gap: 12 }}>
<GlassButton variant="prominent" onPress={() => setSaved(true)}>
{saved ? 'Saved' : 'Save'}
</GlassButton>
<GlassButton disabled={!saved} onPress={() => setSaved(false)}>
Undo
</GlassButton>
</View>
);
}
Examples
Variants
<div className="flex gap-3">
<GlassButton variant="prominent">Prominent</GlassButton>
<GlassButton variant="primary">Primary</GlassButton>
<GlassButton variant="soft">Soft</GlassButton>
<GlassButton variant="ghost">Ghost</GlassButton>
</div>As a link
<GlassButton asChild variant="prominent">
<a href="/pricing">See pricing</a>
</GlassButton>API reference
GlassButton
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'primary' | 'prominent' | 'soft' | 'ghost' | 'primary' | Visual style. prominent is blue glass for the main action; ghost has no glass. |
size | 'sm' | 'md' | 'lg' | 'md' | Control size. |
asChild | boolean | false | Renders the single child, such as a link, with the button's material. disabled has no effect then. |
type | 'button' | 'submit' | 'reset' | 'button' | Native button type. Set 'submit' to submit a form. |
preset | 'control' | 'showcase' | 'control' | Material preset; showcase allows a stronger backdrop blur. |
lens | boolean | true except ghost | Chromium-only rim lens that bends the page behind it. Off while disabled or with reduced transparency. |
Also accepts HTML button attributes.
- Types
ButtonPropsButtonVariantButtonSize
GlassButtonProps accepts React Native Pressable events and accessibility props, plus size, variant and style. Handle taps with onPress.
The React Native props and exports are in the component’s source.