mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 15:39:13 +00:00
## 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.
32 lines
861 B
TypeScript
32 lines
861 B
TypeScript
import { ChevronDown } from 'lucide-react'
|
|
import {
|
|
Button,
|
|
DropdownMenu,
|
|
DropdownMenuContent,
|
|
DropdownMenuItem,
|
|
DropdownMenuTrigger,
|
|
SplitButtonGroup,
|
|
} from 'ui'
|
|
|
|
export default function ButtonSplitDropdownDemo() {
|
|
return (
|
|
<SplitButtonGroup className="w-fit">
|
|
<Button type="button">Export CSV</Button>
|
|
<DropdownMenu>
|
|
<DropdownMenuTrigger asChild>
|
|
<Button
|
|
type="button"
|
|
aria-label="More export formats"
|
|
className="shrink-0 px-1 py-1.25"
|
|
icon={<ChevronDown />}
|
|
/>
|
|
</DropdownMenuTrigger>
|
|
<DropdownMenuContent align="end" className="w-48">
|
|
<DropdownMenuItem>Export JSON</DropdownMenuItem>
|
|
<DropdownMenuItem>Export TSV</DropdownMenuItem>
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
</SplitButtonGroup>
|
|
)
|
|
}
|