@swrve/core
Version:
Core set of Swrve UI Components
27 lines (22 loc) • 595 B
JSX
import React from 'react'
import classNames from 'classnames'
import Input from '../input/input'
import TextWidth from './text-width'
const InputAutosize = ({ style, value, className, ...inputProps }) => (
<TextWidth text={value}>
{({ innerRef, minWidth }) => (
<Input
{...inputProps}
value={value}
innerRef={innerRef}
className={classNames('sw-input-autosize', className)}
style={{
...style,
minWidth
}}
/>
)}
</TextWidth>
)
InputAutosize.displayName = 'InputAutosize'
export default InputAutosize