MDK Logo

Input

Text input with optional label, prefix/suffix slots, and a `search` variant. Forwards refs and all native `input` attributes.

Text input with optional label, prefix/suffix slots, and a search variant. Forwards refs and all native <input> attributes.

import { Input } from "@tetherto/mdk-react-devkit";
PropStatusTypeDefaultDescription
errorOptionalstring | undefinedValidation error message. When provided, displays error styling (red border) and the message below the input.
labelOptionalstring | undefinedOptional label displayed above the input
prefixOptionalReact.ReactNodePrefix element displayed before the input (left side)
variantOptional"search" | "default" | undefined'default'Variant of the input - `default`: Standard text input - `search`: Input with magnifying glass icon on the right
sizeOptionalInputSize | undefined'default'Size of the input - `default`: padding 10px 12px, icon 16px - `medium`: padding 6px 12px, icon 12px
wrapperClassNameOptionalstring | undefinedCustom className for the root wrapper
suffixOptionalReact.ReactNodeSuffix element displayed after the input (right side)

Usage

Text input with label support, prefix/suffix slots, sizes, error state, and a search-icon variant.

Example

/** * Runnable example for Input. */import { useState } from 'react'import { Input } from '@tetherto/mdk-react-devkit'export const InputExample = () => {  const [value, setValue] = useState('')  return (    <div style={{ display: 'flex', flexDirection: 'column', gap: 16, maxWidth: 320 }}>      <Input        id="mac"        label="MAC address"        placeholder="AA:BB:CC:00:00:01"        value={value}        onChange={(e) => setValue(e.target.value)}      />      <Input variant="search" placeholder="Search miners" />      <Input prefix="$" suffix="USD" placeholder="0.00" />      <Input label="Invalid" error="Must be a hex string" defaultValue="abc" />    </div>  )}