You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@leafygreen-ui/polymorphic

Package Overview
Dependencies
Maintainers
6
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@leafygreen-ui/polymorphic - npm Package Compare versions

Comparing version

to
1.1.1

6

CHANGELOG.md
# @leafygreen-ui/polymorphic
## 1.1.1
### Patch Changes
- 97cf09502: Adds additional styled test, and documents `styled` props best practice
## 1.1.0

@@ -4,0 +10,0 @@

2

package.json
{
"name": "@leafygreen-ui/polymorphic",
"version": "1.1.0",
"version": "1.1.1",
"description": "LeafyGreen UI Kit Polymorphic",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -132,2 +132,17 @@ # Polymorphic

### With styled props (and Typescript)
Since Polymorphic components are strictly typed, to use styled props with Typescript
you will need to define the additional props you expect to use within styled, and pass these into styled as generic type.
```tsx
interface StyledProps {
color: string;
}
const MyStyledComponent = styled(MyComponent)<StyledProps>`
color: ${props => props.color};
` as PolymorphicComponentType;
```
Note: TSDocs will not compile for styled polymorphs. This can be remedied by creating a wrapper around the styled function that explicitly returns a PolymorphicComponentType

@@ -134,0 +149,0 @@

Sorry, the diff of this file is not supported yet