# Glassmorphism

A frosted glass card with adjustable blur, inset highlights, elastic dragging and expandable dimensions.

[Read on UI Layouts](https://www.ui-layouts.com/components/glassmorphism)

Use Glassmorphism for a frosted panel over a busy background. You can adjust its blur and highlights or let the panel expand on click. For a lens that bends an image at its edges, see [Liquid Glass](https://www.ui-layouts.com/components/liquid-glass).

## Sidebar menu

Example: `glassmorphism-sidebar-menu` · [glassmorphism-sidebar-menu registry source](https://www.ui-layouts.com/r/glassmorphism-sidebar-menu.json)

## Installation

```bash
npx uilayouts@latest add glassmorphism
```

```bash
npx shadcn@latest add 'https://www.ui-layouts.com/r/glassmorphism.json'
```

```bash
npm install motion
```

[glassmorphism registry source](https://www.ui-layouts.com/r/glassmorphism.json)

## Usage

With the UI Layouts CLI, import from `@/components/uilayouts/glassmorphism`. The example below uses the shadcn install path, `@/components/ui/glassmorphism`. The component uses the `cn` helper from `@/lib/utils`.

```tsx
import { Glassmorphism } from '@/components/ui/glassmorphism';

export function FrostedCard() {
  return (
    <Glassmorphism width="280px" borderRadius="24px" blurIntensity="md">
      <div className="relative z-30 p-6">Weather in Berlin</div>
    </Glassmorphism>
  );
}
```

| Prop                                                 | Purpose                                                                           |
| ---------------------------------------------------- | --------------------------------------------------------------------------------- |
| `blurIntensity`                                      | Select the backdrop blur from `sm`, `md`, `lg` or `xl`. Defaults to `xl`.         |
| `borderRadius`                                       | Set the corner radius. Defaults to `32px`.                                        |
| `glowIntensity`, `shadowIntensity`                   | Set the outer glow and inset highlight from `none` through `2xl`.                 |
| `draggable`                                          | Enable elastic drag. Defaults to `true`.                                          |
| `expandable`                                         | Toggle between the resting and expanded dimensions on click. Defaults to `false`. |
| `width`, `height`, `expandedWidth`, `expandedHeight` | Set CSS dimensions for each state.                                                |

## Weather

Example: `glassmorphism-weather` · [glassmorphism-weather registry source](https://www.ui-layouts.com/r/glassmorphism-weather.json)

## Mobile icons

Example: `glassmorphism-mobile-icons` · [glassmorphism-mobile-icons registry source](https://www.ui-layouts.com/r/glassmorphism-mobile-icons.json)

## Notification

Example: `glassmorphism-notification` · [glassmorphism-notification registry source](https://www.ui-layouts.com/r/glassmorphism-notification.json)
