A React menu component, triangle safe zone that visually shows users the way to the submenu.
A React project with the shadcn/ui structure. If you don't have one:
npx shadcn@latest initCopy liquid-effect-animation.tsx into your project:
src/components/ui/liquid-effect-animation.tsx
import { SafeZoneMenu } from "@/app/components/ui/menu-effect";
const menuItems = [
{
label: "File",
submenu: [
{ label: "New File", href: "/new" },
{ label: "Open File", href: "/open" },
{ label: "Save", href: "/save" },
],
},
{
label: "Edit",
submenu: [
{ label: "Undo", href: "#" },
{ label: "Redo", href: "#" },
{ label: "Cut", href: "#" },
],
},
{ label: "Help" }, // No submenu
];
export default function App() {
return <SafeZoneMenu items={menuItems} />;
}<SafeZoneMenu
items={menuItems}
dotted
/>// Single value - gap is automatically half of dash
<SafeZoneMenu
items={menuItems}
dotted
dotSize={8}
/>
// Array [dash, gap] for precise control
<SafeZoneMenu
items={menuItems}
dotted
dotSize={[12, 4]}
/>| Prop | Type | Default | Description |
|---|---|---|---|
items |
MenuItem[] |
required | Array of menu items to display |
className |
string |
undefined |
Additional CSS classes for the container |
dotted |
boolean |
false |
Whether the triangle border should be dotted |
dotSize |
number | [number, number] |
[4, 2] |
Size of dots when dotted is true. Single number sets dash size (gap = dash/2). Array sets [dash, gap] |
triangleFill |
ColorName |
"blue" |
Fill color of the triangle |
triangleStroke |
ColorName |
"blue" |
Stroke color of the triangle |
Available color options: "blue" | "red" | "green" | "yellow" | "purple" | "pink" | "orange" | "cyan" | "white"
If you want additional colors you can go to the component file and add it in the colormap object to access more colors of your choice.
- Chrome 90+
- Firefox 88+
- Safari 14+
- Edge 90+
MIT