Question
A question the agent asks before it goes on, with options and room for another answer.
Concept, not a real feature. Designed from Linear's radio, kbd, input and the selected row fill from its menus. Progress dots are a guess; the current dot widens with the collapse spring.
import { Button, Question } from "@replicas/ui";
import { useState } from "react";
const options = [
{ value: "postgres", label: "Postgres", description: "Relational, with the existing migrations." },
{ value: "sqlite", label: "SQLite", description: "One file, good for the prototype." },
{ value: "dynamo", label: "DynamoDB", description: "Managed key-value, scales without tuning." },
];
export default function QuestionDemo() {
const [value, setValue] = useState("postgres");
return (
<Question.Root aria-labelledby="question-title" style={{ width: "100%", maxWidth: 520 }}>
<Question.Header>
<Question.Title id="question-title">Which database should the new service use?</Question.Title>
<Question.Step>1 of 2</Question.Step>
</Question.Header>
<Question.Description>I'll set up the schema and the connection once you choose.</Question.Description>
<Question.Options value={value} onValueChange={(next) => setValue(next as string)}>
{options.map((option, index) => (
<Question.Option key={option.value} value={option.value} description={option.description} shortcut={"ABC"[index]}>
{option.label}
</Question.Option>
))}
</Question.Options>
<Question.Other aria-label="Something else" placeholder="Something else…" />
<Question.Footer>
<Question.Progress value={0} total={2} />
<Question.Actions>
<Button variant="ghost" size="small">
Skip
</Button>
<Button variant="primary" size="small">
Continue
</Button>
</Question.Actions>
</Question.Footer>
</Question.Root>
);
}Prompt
Copy Prompt hands your agent everything it needs to build the Question in the Linear style: the measured tokens, the CSS and the structure.
Show Prompt
# Linear Question
A question the agent asks before it goes on, with options and room for another answer.
Build a Question in this project that looks and behaves like Linear's. Measured from the running Linear app (linear.app). Keep every value exact. Map the tokens onto the project's own theme variables instead of hard-coding them. Use the project's own component library for behaviour, or Base UI primitives if it has none.
Fidelity: Concept, not a real feature. Designed from Linear's radio, kbd, input and the selected row fill from its menus. Progress dots are a guess; the current dot widens with the collapse spring.
## Tokens
| Token | Light | Dark |
| --- | --- | --- |
| `--border-secondary` | `lch(88.49% 0 282)` | `lch(14.16% 1.48 272)` |
| `--border-tertiary` | `lch(84.44% 0 282)` | `lch(16.32% 1.48 272)` |
| `--text-primary` | `lch(9.794% 0 282)` | `lch(100% 0 272)` |
| `--text-secondary` | `lch(19.588% 1.25 282)` | `lch(90.451% 1.2 272)` |
| `--text-tertiary` | `lch(39.176% 1.25 282)` | `lch(61.803% 1.2 272)` |
| `--text-quaternary` | `lch(64.64% 1.25 282)` | `lch(36.975% 1.2 272)` |
| `--surface-divider` | `lch(91.9% 0 282)` | `lch(20.28% 1.93 272)` |
| `--surface-text-muted` | `lch(40% 1 282)` | `lch(64.714% 1.425 272)` |
| `--accent` | `lch(53% 52.26 286.91)` | `lch(47.918% 59.303 288.421)` |
| `--accent-text` | `lch(100% 5 286.91)` | `lch(100% 5 288.421)` |
| `--chip-bg` | `lch(100% 0 282)` | `lch(17.574% 1.589 272)` |
| `--chip-ring-hover` | `lch(0% 0 0 / 0.147)` | `lch(100% 0 0 / 0.248)` |
| `--bg-hover` | `lch(94.854% 0.5 282)` | `lch(14.006% 0.593 272)` |
| `--text-faint` | `lch(66% 1 282)` | `lch(41.778% 1.425 272)` |
| `--input-bg` | `lch(100% 0 282)` | `lch(9.345% 0.85 272)` |
| `--input-border` | `lch(86.5% 0 282)` | `lch(31.01% 1.952 272.5)` |
| `--input-border-hover` | `lch(78.5% 0 282)` | `lch(30% 1.5 272)` |
| `--input-text` | `lch(10% 0 282)` | `lch(100% 0 272)` |
| `--card-bg` | `lch(100% 0 282)` | `lch(9.345% 0.85 272)` |
| `--card-ring` | `lch(0% 0 0 / 0.088)` | `lch(100% 0 0 / 0.083)` |
| `--fill-subtle` | `lch(0% 0 0 / 0.032)` | `lch(100% 0 0 / 0.035)` |
| `--shadow-low` | `lch(0% 0 0 / 0.02) 0 3px 6px -2px, lch(0% 0 0 / 0.04) 0 1px 1px 0` | `lch(0% 0 0 / 0.3) 0 0.5px 1px 1px` |
| `--focus-ring` | `#5e69d1` | `#5e69d1` |
| `--font-size-micro` | `0.6875rem` | `0.6875rem` |
| `--font-size-mini` | `0.75rem` | `0.75rem` |
| `--font-size-small` | `0.8125rem` | `0.8125rem` |
| `--font-size-regular` | `0.9375rem` | `0.9375rem` |
| `--font-weight-medium` | `500` | `500` |
| `--font-weight-semibold` | `600` | `600` |
| `--radius-control` | `8px` | `8px` |
| `--radius-kbd` | `4px` | `4px` |
| `--radius-rounded` | `9999px` | `9999px` |
| `--speed-highlight-fade-in` | `0s` | `0s` |
| `--speed-highlight-fade-out` | `0.15s` | `0.15s` |
| `--speed-regular` | `0.25s` | `0.25s` |
| `--duration-checkbox` | `80ms` | `80ms` |
| `--ease-spring-collapse` | `linear(0, 0.0183, 0.0632, 0.1233, 0.191, 0.2611, 0.3304, 0.3969, 0.4593, 0.517, 0.5698, 0.6177, 0.6608, 0.6996, 0.7342, 0.7651, 0.7925, 0.8169, 0.8384, 0.8575, 0.8744, 0.8893, 0.9025, 0.9141, 0.9243, 0.9333, 0.9413, 0.9483, 0.9545, 0.9599, 0.9647, 0.9689, 0.9726, 0.9759, 0.9788, 0.9813, 0.9836, 0.9855, 0.9873, 0.9888, 1)` | `linear(0, 0.0183, 0.0632, 0.1233, 0.191, 0.2611, 0.3304, 0.3969, 0.4593, 0.517, 0.5698, 0.6177, 0.6608, 0.6996, 0.7342, 0.7651, 0.7925, 0.8169, 0.8384, 0.8575, 0.8744, 0.8893, 0.9025, 0.9141, 0.9243, 0.9333, 0.9413, 0.9483, 0.9545, 0.9599, 0.9647, 0.9689, 0.9726, 0.9759, 0.9788, 0.9813, 0.9836, 0.9855, 0.9873, 0.9888, 1)` |
| `--duration-spring-collapse` | `185ms` | `185ms` |
## CSS
Scoped under `[data-style="linear"]`; dark rules sit under `[data-theme="dark"]`. The `ui-*` classes and data attributes match the structure below.
```css
[data-style="linear"] {
.ui-question {
box-sizing: border-box;
display: flex;
flex-direction: column;
min-width: 0;
overflow: hidden;
border-radius: 10px;
background-color: var(--card-bg);
box-shadow:
0 0 0 0.5px var(--card-ring),
var(--shadow-low);
color: var(--text-secondary);
font-family: inherit;
font-size: var(--font-size-small);
}
.ui-question-header {
display: flex;
align-items: baseline;
gap: 12px;
padding: 14px 14px 0;
}
.ui-question-title {
flex: 1;
min-width: 0;
margin: 0;
color: var(--text-primary);
font-size: var(--font-size-regular);
font-weight: var(--font-weight-semibold);
line-height: 22px;
}
.ui-question-step {
flex-shrink: 0;
color: var(--text-tertiary);
font-size: var(--font-size-mini);
font-variant-numeric: tabular-nums;
}
.ui-question-description {
margin: 2px 0 0;
padding: 0 14px;
color: var(--text-tertiary);
font-size: var(--font-size-small);
line-height: 20px;
}
.ui-question-options {
display: flex;
flex-direction: column;
gap: 2px;
padding: 10px 6px 0;
}
.ui-question-option {
box-sizing: border-box;
display: flex;
align-items: center;
gap: 10px;
min-height: 44px;
padding: 6px 8px;
border-radius: var(--radius-control);
cursor: default;
transition: background-color var(--speed-highlight-fade-out);
@media (hover: hover) {
&:hover {
background-color: var(--bg-hover);
transition-duration: var(--speed-highlight-fade-in);
}
}
&:has(.ui-question-radio[data-checked]) {
background-color: var(--fill-subtle);
box-shadow: inset 0 0 0 0.5px var(--border-secondary);
}
&:has(.ui-question-radio:focus-visible) {
outline: 1px solid var(--focus-ring);
outline-offset: -1px;
}
}
.ui-question-radio {
box-sizing: border-box;
display: inline-flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
width: 14px;
height: 14px;
margin: 0;
padding: 0;
border: 0;
border-radius: var(--radius-rounded);
background-color: var(--chip-bg);
box-shadow:
0 0 0 0.5px var(--chip-ring-hover),
var(--shadow-low);
outline: none;
transition:
background-color var(--duration-checkbox) ease-out,
box-shadow var(--duration-checkbox) ease-out;
&[data-checked] {
background-color: var(--accent);
box-shadow: var(--shadow-low);
}
}
.ui-question-indicator {
width: 6px;
height: 6px;
border-radius: var(--radius-rounded);
background-color: var(--accent-text);
}
.ui-question-option-body {
display: flex;
flex: 1;
flex-direction: column;
gap: 1px;
min-width: 0;
}
.ui-question-option-label {
color: var(--text-primary);
font-weight: var(--font-weight-medium);
line-height: 18px;
}
.ui-question-option-description {
color: var(--text-tertiary);
font-size: var(--font-size-mini);
line-height: 16px;
}
.ui-question-shortcut {
box-sizing: border-box;
display: inline-flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
min-width: 17px;
height: 17px;
padding: 0 3px;
border: 0.5px solid var(--surface-divider);
border-radius: var(--radius-kbd);
color: var(--surface-text-muted);
font-family: inherit;
font-size: var(--font-size-micro);
font-weight: 400;
line-height: 1;
}
.ui-question-other {
box-sizing: border-box;
width: calc(100% - 28px);
height: 32px;
margin: 8px 14px 0;
padding: 0 10px;
border: 0.5px solid var(--input-border);
border-radius: var(--radius-control);
background-color: var(--input-bg);
color: var(--input-text);
font-family: inherit;
font-size: var(--font-size-small);
outline: none;
transition: border-color var(--speed-highlight-fade-out);
&::placeholder {
color: var(--text-faint);
}
@media (hover: hover) {
&:hover {
border-color: var(--input-border-hover);
}
}
&:focus-visible {
border-color: var(--focus-ring);
}
}
.ui-question-footer {
box-sizing: border-box;
display: flex;
align-items: center;
gap: 12px;
min-height: 48px;
margin-top: 14px;
padding: 0 10px 0 14px;
border-top: 0.5px solid var(--border-secondary);
}
.ui-question-progress {
display: flex;
align-items: center;
gap: 4px;
}
.ui-question-dot {
width: 6px;
height: 6px;
border-radius: var(--radius-rounded);
background-color: var(--border-tertiary);
transition:
width var(--duration-spring-collapse) var(--ease-spring-collapse),
background-color var(--speed-regular);
&[data-state="complete"] {
background-color: var(--accent);
}
&[data-state="current"] {
width: 16px;
background-color: var(--accent);
}
}
&[data-theme="dark"] .ui-question-dot[data-state="upcoming"] {
background-color: var(--text-quaternary);
}
.ui-question-actions {
display: flex;
align-items: center;
gap: 6px;
margin-left: auto;
& .ui-button[data-variant="ghost"] {
border-color: transparent;
}
}
@media (prefers-reduced-motion: reduce) {
.ui-question-dot {
transition: background-color var(--speed-regular);
}
}
}
```
## Structure
How Replicas assembles it on Base UI.
```tsx
import { Radio as BaseRadio } from "@base-ui/react/radio";
import { RadioGroup as BaseRadioGroup } from "@base-ui/react/radio-group";
import type { ComponentProps, ReactNode } from "react";
import { join } from "./utils";
function Root({ className, ...props }: ComponentProps<"div">) {
return <div role="group" className={join("ui-question", className)} {...props} />;
}
function Header({ className, ...props }: ComponentProps<"div">) {
return <div className={join("ui-question-header", className)} {...props} />;
}
function Title({ className, ...props }: ComponentProps<"p">) {
return <p className={join("ui-question-title", className)} {...props} />;
}
function Step({ className, ...props }: ComponentProps<"span">) {
return <span className={join("ui-question-step", className)} {...props} />;
}
function Description({ className, ...props }: ComponentProps<"p">) {
return <p className={join("ui-question-description", className)} {...props} />;
}
function Options<Value>({ className, ...props }: Omit<BaseRadioGroup.Props<Value>, "className"> & { className?: string }) {
return <BaseRadioGroup className={join("ui-question-options", className)} {...props} />;
}
type OptionProps<Value> = Omit<BaseRadio.Root.Props<Value>, "className"> & {
className?: string;
description?: ReactNode;
shortcut?: ReactNode;
};
function Option<Value>({ className, description, shortcut, children, ...props }: OptionProps<Value>) {
return (
<label className={join("ui-question-option", className)}>
<BaseRadio.Root className="ui-question-radio" {...props}>
<BaseRadio.Indicator className="ui-question-indicator" />
</BaseRadio.Root>
<span className="ui-question-option-body">
<span className="ui-question-option-label">{children}</span>
{description ? <span className="ui-question-option-description">{description}</span> : null}
</span>
{shortcut ? <kbd className="ui-question-shortcut">{shortcut}</kbd> : null}
</label>
);
}
function Other({ className, ...props }: ComponentProps<"input">) {
return <input type="text" className={join("ui-question-other", className)} {...props} />;
}
function Footer({ className, ...props }: ComponentProps<"div">) {
return <div className={join("ui-question-footer", className)} {...props} />;
}
type ProgressProps = Omit<ComponentProps<"span">, "children"> & { value: number; total: number };
function Progress({ className, value, total, ...props }: ProgressProps) {
return (
<span role="img" aria-label={`Step ${value + 1} of ${total}`} className={join("ui-question-progress", className)} {...props}>
{Array.from({ length: total }, (_, index) => (
<span
key={`dot-${index}`}
className="ui-question-dot"
data-state={index < value ? "complete" : index === value ? "current" : "upcoming"}
/>
))}
</span>
);
}
function Actions({ className, ...props }: ComponentProps<"div">) {
return <div className={join("ui-question-actions", className)} {...props} />;
}
export const Question = {
Root,
Header,
Title,
Step,
Description,
Options,
Option,
Other,
Footer,
Progress,
Actions,
};
```
## Example
```tsx
import { Button, Question } from "@replicas/ui";
import { useState } from "react";
const options = [
{ value: "postgres", label: "Postgres", description: "Relational, with the existing migrations." },
{ value: "sqlite", label: "SQLite", description: "One file, good for the prototype." },
{ value: "dynamo", label: "DynamoDB", description: "Managed key-value, scales without tuning." },
];
export default function QuestionDemo() {
const [value, setValue] = useState("postgres");
return (
<Question.Root aria-labelledby="question-title" style={{ width: "100%", maxWidth: 520 }}>
<Question.Header>
<Question.Title id="question-title">Which database should the new service use?</Question.Title>
<Question.Step>1 of 2</Question.Step>
</Question.Header>
<Question.Description>I'll set up the schema and the connection once you choose.</Question.Description>
<Question.Options value={value} onValueChange={(next) => setValue(next as string)}>
{options.map((option, index) => (
<Question.Option key={option.value} value={option.value} description={option.description} shortcut={"ABC"[index]}>
{option.label}
</Question.Option>
))}
</Question.Options>
<Question.Other aria-label="Something else" placeholder="Something else…" />
<Question.Footer>
<Question.Progress value={0} total={2} />
<Question.Actions>
<Button variant="ghost" size="small">
Skip
</Button>
<Button variant="primary" size="small">
Continue
</Button>
</Question.Actions>
</Question.Footer>
</Question.Root>
);
}
```
## Foundations
The rest of the Linear style, as a skill: https://replicas.raphaelsalaja.com/skills/linear/SKILL.md