@leafygreen-ui/polymorphic
Advanced tools
Comparing version 1.1.0 to 1.1.1
# @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 @@ |
{ | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
578002
3548
186