diff --git a/components/input/input.tsx b/components/input/input.tsx index dc85152..81d05f8 100644 --- a/components/input/input.tsx +++ b/components/input/input.tsx @@ -18,6 +18,7 @@ interface Props { labelRight?: string icon?: React.ReactNode iconRight?: React.ReactNode + width?: string className?: string onChange?: (e: React.ChangeEvent) => void } @@ -25,6 +26,7 @@ interface Props { const defaultProps = { disabled: false, readOnly: false, + width: 'initial', size: 'medium', status: 'default', className: '', @@ -37,7 +39,7 @@ export type InputProps = Props & typeof defaultProps & React.InputHTMLAttributes const Input: React.FC = ({ placeholder, label, labelRight, size, status, disabled, icon, iconRight, initialValue, onChange, readOnly, value, - className, ...props + width, className, ...props }) => { const theme = useTheme() const [selfValue, setSelfValue] = useState(initialValue) @@ -91,9 +93,10 @@ const Input: React.FC = ({ align-items: center; box-sizing: border-box; user-select: none; + width: ${width}; height: calc(${heightRatio} * ${theme.layout.gap}); } - + .input-wrapper { display: inline-flex; vertical-align: middle; diff --git a/pages/docs/components/input.mdx b/pages/docs/components/input.mdx index 612f9ac..18670c5 100644 --- a/pages/docs/components/input.mdx +++ b/pages/docs/components/input.mdx @@ -18,6 +18,25 @@ Retrieve text input from a user. `} /> + + + + + + +`} /> + + +`} /> +