{"id":15020308,"url":"https://github.com/ihor/react-styled-floating-label","last_synced_at":"2025-10-25T12:30:26.725Z","repository":{"id":34848456,"uuid":"183924543","full_name":"ihor/react-styled-floating-label","owner":"ihor","description":"Floating label component which works with any HTML input","archived":false,"fork":false,"pushed_at":"2023-01-03T20:48:39.000Z","size":2208,"stargazers_count":36,"open_issues_count":23,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T07:05:45.040Z","etag":null,"topics":["floating-labels","labels","react","reactjs","styled","styled-components"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/react-styled-floating-label","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ihor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-28T15:17:27.000Z","updated_at":"2024-12-18T00:58:16.000Z","dependencies_parsed_at":"2023-01-15T09:33:31.224Z","dependency_job_id":null,"html_url":"https://github.com/ihor/react-styled-floating-label","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ihor%2Freact-styled-floating-label","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ihor%2Freact-styled-floating-label/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ihor%2Freact-styled-floating-label/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ihor%2Freact-styled-floating-label/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ihor","download_url":"https://codeload.github.com/ihor/react-styled-floating-label/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238137822,"owners_count":19422703,"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":["floating-labels","labels","react","reactjs","styled","styled-components"],"created_at":"2024-09-24T19:54:53.412Z","updated_at":"2025-10-25T12:30:21.389Z","avatar_url":"https://github.com/ihor.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"React-Styled-Floating-Label\n===========================\nFloating label component which works with any HTML input. Supports styling with [styled-components](https://styled-components.com). Check this [live demo](http://ihor.burlachenko.com/react-styled-floating-label-demo/) to see it in action.\n\n```jsx\nimport FloatingLabel from 'react-styled-floating-label';\n\nconst email = (\n    \u003cFloatingLabel text=\"Email\"\u003e\n        \u003cinput type=\"email\" /\u003e\n    \u003c/FloatingLabel\u003e\n);\n```\n\nInstallation\n============\n`npm i react-styled-floating-label styled-components --save`\n\n\nUsage\n=====\n\n### Typical Usage Example\n\n```jsx\nimport styled from 'styled-components';\nimport FloatingLabel from 'react-styled-floating-label';\n\nconst BlueFloatingLabel = styled(FloatingLabel)`\n    color: #0070e0;\n`;\n\nconst Input = styled.input`\n    -webkit-appearance: none;\n    -moz-appearance: none;\n    appearance: none;\n    box-sizing: border-box;\n\n    border: none;\n    border-bottom: 0.5px solid #bdbdbd;\n\n    font-size: 1.25em;\n    padding-left: 0.25em;\n    padding-top: 0.25em;\n    min-width: 20em;\n\n    :focus {\n        border-color: #5eaefe;\n        outline: none;\n    }\n`;\n\nconst email = (\n    \u003cBlueFloatingLabel text=\"Email\"\u003e\n        \u003cInput type=\"email\" /\u003e\n    \u003c/BlueFloatingLabel\u003e\n);\n```\n\n![Typical Usage Screen Recording](https://github.com/ihor/react-styled-floating-label/blob/master/demo/screen-recordings/typical-usage.gif?raw=true)\n\n### Styling With Props\n\n```jsx\nimport FloatingLabel from 'react-styled-floating-label';\n\nconst address = (\n    \u003cFloatingLabel\n        text=\"Address\"\n        style={{\n            color: '#0070e0',\n        }}\n        placeholderStyle={{\n            fontWeight: 'bold',\n        }}\u003e\n        \u003cInput /\u003e\n    \u003c/FloatingLabel\u003e\n);\n```\n\n![Styling With Props Screen Recording](https://github.com/ihor/react-styled-floating-label/blob/master/demo/screen-recordings/styling-with-props.gif?raw=true)\n\n### Styled Placeholder\n\n```jsx\nimport styled from 'styled-components';\nimport FloatingLabel from 'react-styled-floating-label';\n\nconst FloatingLabelWithStyledPlaceholder = styled(FloatingLabel)`\n    --placeholder-color: #328a09;\n    --placeholder-font-weight: bold;\n`;\n\nconst Input = styled.input`\n    font-size: 1em;\n`;\n\nconst address = (\n    \u003cFloatingLabelWithStyledPlaceholder text=\"Address\"\u003e\n        \u003cInput /\u003e\n    \u003c/FloatingLabelWithStyledPlaceholder\u003e\n);\n```\n\n![Styled Placeholder Screen Recording](https://github.com/ihor/react-styled-floating-label/blob/master/demo/screen-recordings/styled-placeholder.gif?raw=true)\n\n### Custom Positioning\n\n```jsx\nimport styled from 'styled-components';\nimport FloatingLabel from 'react-styled-floating-label';\n\nconst VerticallyPositionedFloatingLabel = styled(FloatingLabel)`\n    transform: translateY(-10px);\n`;\n\nconst HorizontallyPositionedFloatingLabel = styled(FloatingLabel)`\n    margin-left: 20px;\n`;\n\nconst firstName = (\n    \u003cVerticallyPositionedFloatingLabel text=\"First Name\"\u003e\n        \u003cInput /\u003e\n    \u003c/VerticallyPositionedFloatingLabel\u003e\n);\n\nconst lastName = (\n    \u003cHorizontallyPositionedFloatingLabel text=\"Last Name\"\u003e\n        \u003cInput /\u003e\n    \u003c/HorizontallyPositionedFloatingLabel\u003e\n);\n```\n\n![Custom Positioning Screen Recording](https://github.com/ihor/react-styled-floating-label/blob/master/demo/screen-recordings/custom-positioning.gif?raw=true)\n\nYou can check all examples in action in this [live demo](http://ihor.burlachenko.com/react-styled-floating-label-demo/).\n\nAPI\n===\n\n### Props\n\n| Prop             | Required | Default        | Description\n| :---             |     ---: |           ---: | :---\n| text             |      Yes |                | Label text\n| style            | Optional |           `{}` | Label style for projects which are not using `styled-components`\n| placeholderStyle | Optional |           `{}` | Placeholder style for projects which are not using `styled-components`\n| container        | Optional |          `div` | Component container\n| label            | Optional |        `label` | Label component\n\n### styled-components\n\nLabel can be styled with [styled-components](https://styled-components.com):\n\n```jsx\nimport styled from 'styled-components';\nimport FloatingLabel from 'react-styled-floating-label';\n\nconst BlueFloatingLabel = styled(FloatingLabel)`\n    color: #0070e0;\n`;\n```\n\nTo style placeholder use standard CSS properties with the \"--placeholder-\" prefix:\n\n```jsx\nconst BlueFloatingLabelWithBoldPlaceholder = styled(BlueFloatingLabel)`\n    --placeholder-font-weight: bold;\n`;\n```\n\nDemo\n====\n\nTo run the demo, you need to clone the project and execute:\n```bash\nnpm i \u0026\u0026 npm run demo\n```\n\nOr you can check a live demo [here](http://ihor.burlachenko.com/react-styled-floating-label-demo/).\n\nFeedback\n========\n\nThere are no mailing lists or discussion groups yet. Please use GitHub issues and pull request or follow me on Twitter [@IhorBurlachenko](https://twitter.com/IhorBurlachenko)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fihor%2Freact-styled-floating-label","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fihor%2Freact-styled-floating-label","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fihor%2Freact-styled-floating-label/lists"}