Input Fields
Input fields allow users to enter text, dates, and other structured data within a form. Each field type includes clear labeling and validation to support a consistent, accessible experience.
@volvo-cars/css v2.5.1@volvo-cars/react-forms v2.0.1
Text Input Floating Label
Section titled “Text Input Floating Label”Show code
import { TextInput } from '@volvo-cars/react-forms';
export function TextInputFloatingLabel() { return ( <TextInput name="full-name" label="Full name" variant="floating-label" /> );}Input Types
Section titled “Input Types”Show code
import { EmailInput, PasswordInput, TelInput, TextInput,} from '@volvo-cars/react-forms';
export function InputTypes() { return ( <div className="flex-col gap-16"> <TextInput name="full-name" label="Full name" variant="top-label" /> <EmailInput name="email" label="Email address" variant="top-label" /> <PasswordInput name="password" label="Password" showPasswordLabel="Show password" variant="top-label" /> <TelInput name="phone" label="Phone number" variant="top-label" /> </div> );}Date Input Example
Section titled “Date Input Example”Show code
import { DateInput } from '@volvo-cars/react-forms';
export function DateInputExample() { return <DateInput name="start-date" label="Start date" variant="top-label" />;}Currency Input Example
Section titled “Currency Input Example”Show code
import { CurrencyInput } from '@volvo-cars/react-forms';
export function CurrencyInputExample() { return <CurrencyInput name="price" label="Price" currency="EUR" />;}Unit Input Example
Section titled “Unit Input Example”Show code
import { UnitInput } from '@volvo-cars/react-forms';
export function UnitInputExample() { return <UnitInput name="distance" label="Distance" unit="kilometer" />;}Text Area Basic
Section titled “Text Area Basic”Show code
import { TextArea } from '@volvo-cars/react-forms';
export function TextAreaBasic() { return ( <TextArea name="message" label="Message" variant="top-label" rows={4} /> );}Input Validation
Section titled “Input Validation”Show code
import { TextInput } from '@volvo-cars/react-forms';
export function InputValidation() { return ( <div className="flex-col gap-16"> <TextInput name="email" label="Email" errorMessage="Enter a valid email address" variant="top-label" /> <TextInput name="city" label="City" hint="We use this to find dealers near you" variant="top-label" /> </div> );}Text Input Controlled
Section titled “Text Input Controlled”Show code
import { TextInput } from '@volvo-cars/react-forms';import { useState } from 'react';
export function TextInputControlled() { const [value, setValue] = useState('');
return ( <TextInput name="city" label="City" value={value} onChange={(e) => setValue(e.target.value)} variant="top-label" /> );}