Skip to content

Input

Input is the text field. It renders a pill that contains the native <input> and optional elements before and after it.

import { Input } from '@beyul/sulmu-ui'

Source · Figma

import { Input } from '@beyul/sulmu-ui'
export default function Example() {
return (
<div style={{ maxWidth: 320 }}>
<Input aria-label="Client name" placeholder="Placeholder" />
</div>
)
}
import { Input, Stack } from '@beyul/sulmu-ui'
export default function Example() {
return (
<Stack style={{ maxWidth: 320 }}>
<Input placeholder="Placeholder" aria-label="Empty" />
<Input defaultValue="Beyond Borders Agency" aria-label="Filled" />
<Input invalid defaultValue="contact@" aria-label="Invalid" />
<Input disabled defaultValue="Read only value" aria-label="Disabled" />
</Stack>
)
}
import { Input, Stack } from '@beyul/sulmu-ui'
export default function Example() {
return (
<Stack style={{ maxWidth: 320 }}>
<Input size="sm" placeholder="Small, 36px" aria-label="Small" />
<Input placeholder="Medium, 40px" aria-label="Medium" />
<Input size="lg" placeholder="Large, 48px" aria-label="Large" />
</Stack>
)
}

leftElement and rightElement take an icon or short text.

$USD
import { CalendarIcon, Input, SearchNormalIcon, Stack } from '@beyul/sulmu-ui'
export default function Example() {
return (
<Stack style={{ maxWidth: 320 }}>
<Input aria-label="Search" placeholder="Search..." leftElement={<SearchNormalIcon />} />
<Input aria-label="Date" placeholder="MM/DD/YYYY" rightElement={<CalendarIcon />} />
<Input aria-label="Amount" placeholder="0.00" leftElement="$" rightElement="USD" />
</Stack>
)
}

The translucent variant is the search field that sits on the page canvas, as in the Top Bar.

import { Input, SearchNormalIcon } from '@beyul/sulmu-ui'
export default function Example() {
return (
<div style={{ maxWidth: 320 }}>
<Input
variant="translucent"
aria-label="Search"
placeholder="Search..."
rightElement={<SearchNormalIcon />}
/>
</div>
)
}
PropTypeDefaultDescription
size"sm" | "md" | "lg"mdsm 36px, md 40px, lg 48px. Default: md.
variant"outline" | "translucent"outlineoutline (default) or translucent, for the search field on the page canvas.
invalidboolean-Marks the value as wrong. Inside a Field this is set for you.
leftElementReactNode-Icon or short text before the value, e.g. <SearchNormalIcon />.
rightElementReactNode-Icon or short text after the value.
rootClassNamestring-Class for the outer pill. className goes to the same element.

Input also accepts every native input attribute except size (value, onChange, placeholder, type, disabled, name and so on). They go to the <input> element, and so does the ref.

  • Wrap the input in a Field to give it a label. On its own it needs an aria-label.
  • Inside a Field, the input takes its id, invalid, disabled and required from the Field.
  • className and rootClassName both go to the outer pill, not to the <input>.