Getting Started
Components
- Agent Status
- Agent Template Card
- API Key Card
- Audio Player
- Bar Visualizer
- Channel Status Card
- Chat Composer
- Code Editor
- Condition Builder
- Confirm Dialog
- Conversation
- Conversation Bar
- Dataset Card
- Document Status Badge
- Extraction Strategy Select
- File Icon
- File Upload
- Indexing Progress
- Live Waveform
- Matrix
- Message
- Mic Selector
- Model Diff View
- Model Selector
- Model Type Filter
- Node Catalog
- Option Editor
- Orb
- Output Variables View
- Package Card
- Prompt Editor
- Provider Status Card
- Radio Card
- Resource Card
- Resource Sidebar
- Response
- Run Node List
- Scrub Bar
- Segment Card
- Shimmering Text
- Speech Input
- Token Trend Chart
- Tool Call Card
- Transcript Viewer
- Usage Stat Card
- Variable Binding Editor
- Variable Selector
- Voice Button
- Voice Picker
- Waveform
- Workflow Node Card
- Workspace Selector
Extraction
import { ExtractionStrategySelect } from "@/components/ui/extraction-strategy-select"
const strategies = [
{
value: "text",
label: "Text extraction",
description: "Fast parser for clean PDF and Markdown files.",
},
{
value: "vision",
label: "Vision parser",
description: "Best for scanned pages and visual layouts.",
recommended: true,
},
{
value: "table",
label: "Table-aware",
description: "Preserves spreadsheet-like structure.",
},
{
value: "graph",
label: "Knowledge graph",
description: "Requires graph indexing to be enabled.",
disabled: true,
},
]
export function ExtractionStrategySelectDemo() {
return (
<ExtractionStrategySelect
value="vision"
options={strategies}
className="h-9 w-64"
/>
)
}
Installation
pnpm dlx shadcn@latest add https://ui.zgi.ai/r/extraction-strategy-select.jsonpnpm dlx shadcn@latest add https://ui.zgi.ai/r/extraction-strategy-select.json
yarn dlx shadcn@latest add https://ui.zgi.ai/r/extraction-strategy-select.jsonComponent
"use client"
import * as React from "react"
import { Badge } from "@/components/ui/badge"
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select"
export interface ExtractionStrategyOption {
value: string
label: React.ReactNode
description?: React.ReactNode
recommended?: boolean
disabled?: boolean
}
export interface ExtractionStrategySelectProps {
value?: string
onValueChange?: (value: string, option: ExtractionStrategyOption) => void
options: ExtractionStrategyOption[]
label?: React.ReactNode
placeholder?: string
recommendedLabel?: React.ReactNode
unavailableLabel?: React.ReactNode
disabled?: boolean
loading?: boolean
className?: string
}
export function ExtractionStrategySelect({
value,
onValueChange,
options,
label = "Extraction",
placeholder = "Select strategy",
recommendedLabel = "Recommended",
unavailableLabel = "Unavailable",
disabled = false,
loading = false,
className,
}: ExtractionStrategySelectProps) {
return (
<div className="flex flex-wrap items-center gap-2">
{label ? (
<span className="text-muted-foreground text-sm whitespace-nowrap">
{label}
</span>
) : null}
<Select
value={value}
onValueChange={(next) => {
const option = options.find((item) => item.value === next)
if (option) onValueChange?.(next, option)
}}
disabled={disabled || loading || options.length === 0}
>
<SelectTrigger className={className ?? "h-9 w-52"}>
<SelectValue placeholder={placeholder} />
</SelectTrigger>
<SelectContent>
{options.map((option) => (
<SelectItem
key={option.value}
value={option.value}
disabled={option.disabled}
>
<span className="flex w-full items-center justify-between gap-3">
<span className="min-w-0">
<span className="block truncate">{option.label}</span>
{option.description ? (
<span className="text-muted-foreground block truncate text-xs">
{option.description}
</span>
) : null}
</span>
{option.recommended ? (
<Badge
variant="secondary"
className="h-5 rounded-sm px-1.5 text-[11px]"
>
{recommendedLabel}
</Badge>
) : option.disabled ? (
<span className="text-muted-foreground text-xs">
{unavailableLabel}
</span>
) : null}
</span>
</SelectItem>
))}
</SelectContent>
</Select>
</div>
)
}
Usage
import { ExtractionStrategySelect } from "@/components/ui/extraction-strategy-select"
export function Example() {
return (
<ExtractionStrategySelect
value="vision"
options={[{ value: "vision", label: "Vision parser", recommended: true }]}
/>
)
}Props
| Prop | Type | Default |
|---|---|---|
| options | ExtractionStrategyOption[] | required |
| value | string | - |
| onValueChange | (value, option) => void | - |
| label | ReactNode | "Extraction" |
| placeholder | string | "Select strategy" |
| loading | boolean | false |
| disabled | boolean | false |
Deploy and Scale Agents with ZGI
ZGI delivers the infrastructure and developer experience you need to ship reliable audio & agent applications at scale.
Talk to an expert