Compare alternatives
The application keeps every alternative. Navigating does not generate a new response.
Navigates saved response alternatives with stable identity, previous and next controls, and a readable position.
Give each decision an owner and a next step.
The application keeps every alternative. Navigating does not generate a new response.
npm install @noorddev/vlak-react
Load the stylesheet once at your app root, then import the components you use.
import "@noorddev/vlak-react/css";
import { Response, ResponseBranch } from "@noorddev/vlak-react";Per-component imports are available at @noorddev/vlak-react/components/response-branch.
npx @noorddev/vlak-cli add response-branch
Adds the component and its dependencies to components/vlak/. Follow the StyleX setup to compile the source in your application.
npx shadcn add https://vlak.dev/r/response-branch.json
Installs the same source through the shadcn CLI.
import { Response, ResponseBranch } from "@noorddev/vlak-react";
<ResponseBranch branches={[
{ id: "first", content: <Response>Give each decision an owner.</Response> },
{ id: "second", content: <Response>Start with a clear review flow.</Response> },
]} />See the integration example to compose these components with your application's model and data.
Navigates application-owned response alternatives without changing conversation history.
| Prop | Type | Default | Description |
|---|---|---|---|
branchesrequired | readonly ResponseBranchItem[] | ||
value | string | ||
defaultValue | string | ||
onValueChange | (value: string) => void | ||
label | string | "Response alternatives" |
Also accepts Omit<HTMLAttributes<HTMLDivElement>, "children" | "defaultValue">.
The ref reaches HTMLDivElement.
| Keys | Does |
|---|---|
| Tab | Reaches available previous and next buttons and interactive content in the selected response. |
| Enter, Space | Requests the adjacent response through the focused native button. |
The same styles are available as CSS. Native HTML provides the static presentation; React or application code supplies state updates and actions.
npm install @noorddev/vlak
import "@noorddev/vlak/css";
<div class="rs-response-branch"><div class="rs-response-branch-content" id="branch-content"><p>Give each decision an owner and a next step.</p></div><div class="rs-response-branch-controls" role="group" aria-label="Response alternatives"><button class="rs-btn-subtle rs-response-branch-action" type="button" disabled aria-label="Previous response" aria-controls="branch-content">‹</button><span class="rs-response-branch-position" role="status" aria-live="polite">1 / 2</span><button class="rs-btn-subtle rs-response-branch-action" type="button" aria-label="Next response" aria-controls="branch-content">›</button></div></div>