Brickslab.Toolsv2.1.5

@brickslab./ui-webQuiz

Single-line or multiline text input with character counter and min/max length validation.

Single line

Multiline with counter

0/300

With min length hint

Min 50 characters0

Props

PropTypeDéfautRequisDescription
valuestring——Current text value.
onChange(v: string) => void—✓Called on every keystroke.
multilinebooleanfalse—Renders a resizable textarea instead of an input.
minLengthnumber——Shows a min length hint below the input.
maxLengthnumber——Native maxLength attribute + counter if showCount is true.
placeholderstring——Placeholder text.
showCountbooleanfalse—Shows character counter below the input.
disabledbooleanfalse—Disables the input.
Override rapide

Tous les paramètres listés dans cette table sont overrideables via les props. Utilisez ce squelette comme point de départ.

<MyComponent
  value="..."
  onChange="..."
  multiline={false}
  minLength={0}
  maxLength={0}
  placeholder="..."
  showCount={false}
  disabled={false}
/>
valueonChangemultilineminLengthmaxLengthplaceholdershowCountdisabled

Usage

tsx
import { FreeTextQuestion } from "@brickslab./ui-web";

const [value, setValue] = useState("");

<FreeTextQuestion
  value={value}
  onChange={setValue}
  multiline
  placeholder="Describe your experience…"
  maxLength={500}
  showCount
/>