Installation
Section titled “Installation”- Package
@bigbang/ui- Import
import { IbanInput } from '@bigbang/ui';- Source
- IbanInput.tsx
- Storybook
- IbanInput · Playground
IbanInput is in the @bigbang/ui package.
import { IbanInput } from '@bigbang/ui';
<IbanInput label="IBAN" name="iban" onValueChange={(iban, { valid }) => setIban(valid ? iban : null)} />;The normalizeIban, formatIban and isValidIban helpers are exported too.
labelRequired- Description
- The visible label of the field. Screen readers also hear that it takes the 24 digits after TR.
- Type
string
description- Description
- Help text under the field, linked to the input with
aria-describedby. - Type
ReactNode
error- Description
- When set, the field is marked invalid and this message replaces the built-in ones.
- Type
string
invalid- Description
- Marks the field invalid without a message, for example when the message is in an error summary.
- Type
boolean- Default
false
required- Description
- The value is required: the input gets
required, and the label is marked. - Type
boolean- Default
false
necessityIndicator- Description
- Which fields the form marks:
'required'marks required fields,'optional'marks the others. - Type
'required' | 'optional'- Default
'required'
size- Description
- Input height: 32, 36 and 40 px.
- Type
'sm' | 'md' | 'lg'- Default
'md'
value- Description
- Controlled IBAN, with or without spaces ("TR33 0006…"). Pass it with
onValueChange. - Type
string
defaultValue- Description
- Initial IBAN when the field is uncontrolled.
- Type
string
onValueChange- Description
- Called with the IBAN without spaces ("TR3300…", or "" when empty) and whether it is complete and passes the check digits.
- Type
(value: string, state: { valid: boolean; complete: boolean; }) => void
readOnly- Description
- The value can be read, focused and copied but not changed.
- Type
boolean- Default
false
disabled- Description
- Disables the field and its label; the value is not submitted with the form.
- Type
boolean- Default
false
name- Description
- Field name; the form gets the IBAN without spaces.
- Type
string
className- Description
- Added to the root element; use it for layout only.
- Type
string
Data attributes
Section titled “Data attributes”data-component="iban-input"anddata-validwhile valid.data-part:box,prefix,control,valid.