{"id":27056227,"url":"https://github.com/kierien/react-autowidth-input","last_synced_at":"2025-04-05T10:01:37.585Z","repository":{"id":46818133,"uuid":"303318924","full_name":"kierianlee/react-autowidth-input","owner":"kierianlee","description":"Highly configurable \u0026 extensible automatically sized input field built with hooks.","archived":false,"fork":false,"pushed_at":"2023-12-28T16:57:27.000Z","size":1831,"stargazers_count":11,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-07-18T21:42:50.717Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kierianlee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-10-12T07:57:33.000Z","updated_at":"2024-02-23T18:16:41.000Z","dependencies_parsed_at":"2024-04-17T13:43:24.036Z","dependency_job_id":"58ab37d6-3bec-426a-99c5-f607e44be93d","html_url":"https://github.com/kierianlee/react-autowidth-input","commit_stats":null,"previous_names":["kierianlee/react-autowidth-input","inkiear/react-autowidth-input","kierien/react-autowidth-input"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kierianlee%2Freact-autowidth-input","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kierianlee%2Freact-autowidth-input/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kierianlee%2Freact-autowidth-input/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kierianlee%2Freact-autowidth-input/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kierianlee","download_url":"https://codeload.github.com/kierianlee/react-autowidth-input/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247318742,"owners_count":20919484,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-05T10:01:19.792Z","updated_at":"2025-04-05T10:01:37.538Z","avatar_url":"https://github.com/kierianlee.png","language":"TypeScript","funding_links":[],"categories":["UI Components"],"sub_categories":["Form Components"],"readme":"# React Autowidth Input\n\nHighly configurable \u0026 extensible automatically sized input field.\n\n[![npm version](https://img.shields.io/npm/v/react-autowidth-input)](https://www.npmjs.com/package/react-autowidth-input)\n\n## Features\n\n-   Works out of the box with zero config\n-   Supports usage as a controlled or uncontrolled input\n-   Supports custom refs\n-   Miniscule bundle size\n\n## Install\n\n    npm i react-autowidth-input\n\n## Quick Start\n\n```jsx\nimport AutowidthInput from \"react-autowidth-input\";\n\n\u003cAutowidthInput\n    value={inputValue}\n    onChange={(event) =\u003e {\n        // event.target.value contains the new value\n    }}\n/\u003e;\n```\n\n## Additional Props\n\nThe component supports the following props in extension to the regular html input props.\n\n### extraWidth\n\n_extraWidth={number}_\n\nDefault: 16\n\nThe amount of additional space rendered after the input.\n\n```jsx\nimport React from \"react\";\nimport AutowidthInput from \"react-autowidth-input\";\n\nconst MyComponent = () =\u003e {\n    return \u003cAutowidthInput extraWidth={16} /\u003e;\n};\n\n...\n```\n\n### wrapperClassName\n\n_wrapperClassName={string}_\n\nClass provided to the wrapper element encapsulating the input.\n\n```jsx\nimport React from \"react\";\nimport AutowidthInput from \"react-autowidth-input\";\n\nconst MyComponent = () =\u003e {\n    return \u003cAutowidthInput wrapperClassName=\"my-class\" /\u003e;\n};\n\n...\n```\n\n### wrapperStyle\n\n_wrapperStyle={{}}_\n\nInline styles provided to the wrapper element encapsulating the input.\n\n```jsx\nimport React from \"react\";\nimport AutowidthInput from \"react-autowidth-input\";\n\nconst myStyles = {\n    padding: \"1rem\"\n}\n\nconst MyComponent = () =\u003e {\n    return \u003cAutowidthInput wrapperStyle={myStyles}/\u003e\n};\n\n...\n```\n\n### onAutoSize\n\n_onAutoSize={(newWidth) =\u003e {}}_\n\nCallback function to be fired on input resize. `newWidth` does not include width specified by `extraWidth` (see [above for `extraWidth` prop](#extrawidth))\n\n```jsx\nimport React, {useState} from \"react\";\nimport AutowidthInput from \"react-autowidth-input\";\n\nconst MyComponent = () =\u003e {\n    const [width, setWidth] = useState(0);\n\n    const myFunction = (newWidth) =\u003e {\n        setWidth(newWidth);\n    }\n\n    return \u003cAutowidthInput onAutosize={myFunction}/\u003e\n};\n\n...\n```\n\n### placeholderIsMinWidth\n\n_placeholderIsMinWidth={boolean}_\n\nIf set to true, the input will never resize to be smaller than the width of the placeholder.\n\n```jsx\nimport React from \"react\";\nimport AutowidthInput from \"react-autowidth-input\";\n\nconst MyComponent = () =\u003e {\n    return \u003cAutowidthInput placeholderIsMinWidth={true}/\u003e\n};\n\n...\n```\n\n### minWidth\n\n_minWidth={number}_\n\nIf set, specifies the minimum width of input element. Width specified by `extraWidth` is applied anyway, so actual minimum width is actually `extraWidth + minWidth` (see [above for `extraWidth` prop](#extrawidth))\n\n```jsx\nimport React from \"react\";\nimport AutowidthInput from \"react-autowidth-input\";\n\nconst MyComponent = () =\u003e {\n    return \u003cAutowidthInput minWidth={15}/\u003e\n};\n\n...\n```\n\n## Notes\n\nThis component was inspired by Jed Watson's react-input-autosize, but rebuilt with modern react APIs.\n\n## Contributors\n\n-   [kierien](https://github.com/kierien)\n-   [burtek](https://github.com/burtek)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkierien%2Freact-autowidth-input","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkierien%2Freact-autowidth-input","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkierien%2Freact-autowidth-input/lists"}