{"id":21201887,"url":"https://github.com/codepunkt/styled-property","last_synced_at":"2025-07-06T10:33:23.080Z","repository":{"id":57373375,"uuid":"79029000","full_name":"codepunkt/styled-property","owner":"codepunkt","description":"Styled components helper that generates styles and sets the auto-generated className for them as property on a wrapped component.","archived":false,"fork":false,"pushed_at":"2018-05-13T17:12:20.000Z","size":37,"stargazers_count":11,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-29T21:46:34.637Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/codepunkt.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}},"created_at":"2017-01-15T11:40:57.000Z","updated_at":"2018-03-08T12:38:03.000Z","dependencies_parsed_at":"2022-08-29T14:42:18.863Z","dependency_job_id":null,"html_url":"https://github.com/codepunkt/styled-property","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/codepunkt/styled-property","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codepunkt%2Fstyled-property","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codepunkt%2Fstyled-property/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codepunkt%2Fstyled-property/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codepunkt%2Fstyled-property/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codepunkt","download_url":"https://codeload.github.com/codepunkt/styled-property/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codepunkt%2Fstyled-property/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263885642,"owners_count":23525130,"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":"2024-11-20T20:11:55.594Z","updated_at":"2025-07-06T10:33:23.027Z","avatar_url":"https://github.com/codepunkt.png","language":"JavaScript","readme":"# styledProperty\n[![npm version](https://badge.fury.io/js/styled-property.svg)](https://badge.fury.io/js/styled-property) [![Build Status](https://travis-ci.org/codepunkt/styled-property.svg?branch=master)](https://travis-ci.org/codepunkt/styled-property) [![Coverage Status](https://coveralls.io/repos/github/codepunkt/styled-property/badge.svg?branch=master)](https://coveralls.io/github/codepunkt/styled-property?branch=master)\n\n[`styled-components`](https://github.com/styled-components/styled-components) helper that generates a set of styles and sets the auto-generated className for them as property on a wrapped component.\n\n## Installation\n```bash\nnpm install styled-property\n```\n## Usage\n```javascript\nimport styledProperty from 'styled-property'\n\n// auto-generates a class selector for the given css and sets it\n// as \"propName\" property on the WrappedComponent.\nconst Component = styledProperty(WrappedComponent, 'propName')`\n  display: block;\n`\n```\n## Use Cases\n\n### react-router `Link`\n\nSet default and active styles of `Link` component from [`react-router`](https://github.com/ReactTraining/react-router).\n\n```javascript\nimport { Link } from 'react-router'\nimport styled from 'styled-components'\nimport styledProperty from 'styled-property'\n\n// create basic Link styles\nconst BaseLink = styled(Link)`\n  color: #aaa;\n  display: inline-block;\n  text-decoration: none;\n`\n\n// create an additional set of style rules and set the \"activeClassName\"\n// property of the wrapped component (BaseLink) to the auto-generated\n// className for those styles.\nconst StyledLink = styledProperty(BaseLink, 'activeClassName')`\n  color: #bada55;\n`\n```\n\n### react-sticky `Sticky`\n\nSet default and sticky styles of `Sticky` component from [`react-sticky`](https://github.com/captivationsoftware/react-sticky).\n\n```javascript\nimport { Sticky } from 'react-sticky'\nimport styled from 'styled-components'\nimport styledProperty from 'styled-property'\n\n// create basic Sticky styles\nconst BaseSticky = styled(Sticky)`\n  margin-top: 0;\n  transition: margin-top .3s ease-in-out;\n`\n\n// create an additional set of style rules and set the \"stickyClassName\"\n// property of the wrapped component (BaseSticky) to the auto-generated\n// className for those styles.\nconst StyledSticky = styledProperty(BaseSticky, 'stickyClassName')`\n  margin-top: 16px;\n`\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodepunkt%2Fstyled-property","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodepunkt%2Fstyled-property","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodepunkt%2Fstyled-property/lists"}