Skip to content
GitHub ↗

Navigation / React + CSS

Floating dock

A compact action dock with lifting icons and a sliding selection indicator.

Live preview

Home

Make it yours

Use for a small set of frequent workspace actions. This example changes selection and calls onSelect; connect that callback to real content. Use links instead if each destination is a separate URL.

  1. Use a React project with CSS Modules support, such as Next.js or Vite.
  2. Save the JSX as FloatingDock.jsx and the CSS as FloatingDock.module.css in the same folder.
  3. Import FloatingDock and connect its props to your application. Controlled components need parent state and change handlers.

No third-party component or animation package is required. Use the theme controls to adjust accent, corners, spacing, and type. Copy the Theme CSS into your stylesheet and wrap your components in <div className="tdp-components">. The theme applies to every component inside that wrapper. TDP defaults work without a theme file.

Props

PropTypeUse
itemsarrayUnique id, label, and decorative glyph per action.
onSelectfunctionReceives the chosen id. Connect to your view logic.

Accessibility & behavior

Buttons expose selected state through aria-pressed and names through aria-label. Every action has a touch-sized target. Tooltips also appear on keyboard focus.

Visible focus styles and reduced-motion support are included. Check labels, contrast, keyboard behavior, and screen-reader output again after adapting the component to your product.

Keep building