Loading component…
Loading component…
Suggestion card with a confidence signal, alternatives to switch to and accept with undo
To reuse this local React demo, copy all files from the Code tab into the same folder, then import SmartRecommendation from ./smart-recommendation.
import { SmartRecommendation } from "@/components/ui/smart-recommendation";
const options = [
{ id: "incremental", label: "Incremental sync", reason: "Only 4% of rows changed.", signal: 3 },
{ id: "full", label: "Full refresh", reason: "Rebuilds every table.", signal: 1 },
];
export function Sync() {
return <SmartRecommendation options={options} onAccept={(o) => api.setMode(o.id)} />;
}| Name | Type | Default | Description |
|---|---|---|---|
| options | Recommendation[] | The first is recommended, the rest are alternatives – id, label, reason and signal (0–3) | |
| onAccept | (option) => void | Called when an option is accepted | |
| onUndo | (option) => void | Called when an accept is undone | |
| defaultOpen | boolean | true | Starts with the reason visible |
| title | string | "Smart recommendation" | Heading of the card |
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"
@import "tailwindcss"; in your main CSS file.