Navigation / CSS
Glass dock
A compact floating navigation dock with tactile focus and hover magnification.
Preparing the component workbench…
Navigation / CSS
A compact floating navigation dock with tactile focus and hover magnification.
SOURCE / REACT · provisional
import GlassDock from "@/components/buildwithme/glass-dock/react";
<GlassDock />// Adapted from https://github.com/Ashutoshx7/VengeanceUI/blob/main/src/components/ui/glass-dock.tsx under MIT. Copyright (c) Ashutoshx7.
'use client';
import { useState } from 'react';
import { useAnimation } from './use-animation';
import './base.css';
import './glass-dock.css';
export default function GlassDock({
label = 'Glass dock',
paused = false,
}: {
label?: string;
paused?: boolean;
}) {
const { ref, active } = useAnimation(paused);
const [selected, setSelected] = useState('Home');
const items = ['Home', 'Search', 'Create', 'Profile'];
const icons = ['⌂', '⌕', '+', '◉'];
return (
<div ref={ref} className="bw-demo" data-active={active}>
<div>
<nav className="adapt-dock" aria-label={label}>
{items.map((item, i) => (
<button
type="button"
key={item}
aria-label={item}
aria-pressed={selected === item}
onClick={() => setSelected(item)}
>
<span aria-hidden="true">{icons[i]}</span>
</button>
))}
</nav>
<p className="bw-caption" role="status">
{selected} selected
</p>
</div>
</div>
);
}
Install the registry item to receive all 7 files and their declared dependencies. Copying one file may require the other files shown here.