Files
supabase/apps/design-system/registry/default/example/button-dropdown.tsx
Danny White e2425b7214 docs(design-system): clarify related split-button actions (#52349)
## Problem

The Button guidance explains split buttons but doesn't show how to group
a visible action with other actions for the same item or section.

## Solution

Document when to use each pattern:

- **Split button:** the main button runs the most common variation of an
action. The attached chevron opens alternatives, such as other export
formats.
- **Dropdown button:** the whole button opens a menu, such as a
time-range picker.
- **Button with more actions:** keep the main action visible and use a
separate ellipsis menu for distinct actions. The examples show both a
primary “Add pipeline” button and a default “Stop” button.

Align the Admonition split-button example with the same guidance.

## Review instructions

1. Open the [Button guidance
preview](https://design-system-git-dnywh-docs-related-split-buttons-supabase.vercel.app/design-system/docs/components/button#split-with-dropdown)
and compare the attached export chevron with the single time-range
dropdown.
2. Open each ellipsis in [Button with more
actions](https://design-system-git-dnywh-docs-related-split-buttons-supabase.vercel.app/design-system/docs/components/button#button-with-more-actions).
Check that the “Add pipeline” menu groups usage and settings separately
from “Disable Pipelines”, and that the “Stop” menu separates restart
from edit and delete.
2026-11-13 12:05:43 +11:00

38 lines
1000 B
TypeScript

'use client'
import { ChevronDown } from 'lucide-react'
import { useState } from 'react'
import {
Button,
DropdownMenu,
DropdownMenuContent,
DropdownMenuRadioGroup,
DropdownMenuRadioItem,
DropdownMenuTrigger,
} from 'ui'
const ranges = ['Last hour', 'Last 24 hours', 'Last 7 days']
export default function ButtonDropdownDemo() {
const [range, setRange] = useState('Last 24 hours')
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button type="button" iconRight={<ChevronDown />} aria-label={`Time range: ${range}`}>
{range}
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuRadioGroup value={range} onValueChange={setRange}>
{ranges.map((option) => (
<DropdownMenuRadioItem key={option} value={option}>
{option}
</DropdownMenuRadioItem>
))}
</DropdownMenuRadioGroup>
</DropdownMenuContent>
</DropdownMenu>
)
}