Skip to main content

CoreTextInput

Headless TextInput with a subset of Box layout props and typography props combined. No default border, background, or font, style it entirely via props.

Supports ref forwarding.

Preview

import { CoreTextInput } from '@devraj-labs/vajra-ui-core';

<CoreTextInput
p={12}
rounded={8}
borderWidth={1}
borderColor="#E5E7EB"
fontSize={14}
color="#111827"
placeholder="Type here…"
placeholderColor="#D1D5DB"
/>

Usage

import { CoreTextInput } from '@devraj-labs/vajra-ui-core';

<CoreTextInput
p={12}
rounded={8}
borderWidth={1}
borderColor="#E5E7EB"
fontSize={14}
color="#111827"
placeholder="Type here…"
placeholderColor="#D1D5DB"
/>

API

Layout props

PropTypeMaps to
wDimensionValuewidth
hDimensionValueheight
m mx my mt mb ml mrnumbermargin variants
p px py pt pb pl prnumberpadding variants
borderWidthnumberborderWidth
borderColorstringborderColor
roundednumberborderRadius
bgstringbackgroundColor

Typography props

PropTypeMaps to
colorstringcolor
fontSizenumberfontSize
lineHeightnumberlineHeight
fontWeightTextStyle['fontWeight']fontWeight
letterSpacingnumberletterSpacing

Input-specific

PropTypeDescription
placeholderColorstringShorthand for placeholderTextColor
styleTextStyle | TextStyle[]Merged last

Also accepts all native TextInputProps.

CoreTextInput does not accept flex or position props. Wrap it in a Box when those are needed.

Example

CoreTextInput example