Skip to content

Commit bf36f67

Browse files
committed
update readme
1 parent 3a57508 commit bf36f67

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,46 @@ const CodepenEmbedded = () => {
2626
);
2727
}
2828
```
29+
30+
## Component Props
31+
32+
Property | Type | Required | Default | Description |
33+
-----------|----------|----------|-------------|---------------------------------------------------------------|
34+
hash | `string` | `true` | | Id of the pen to embed |
35+
user | `string` | `true` | | Codepen username |
36+
height | `string` | `false` | `300` | Height of the pen |
37+
loader | `node` | `false` | | Loader to render while the pen is being embedded or errors out|
38+
defaultTab | `string` | `false` | `css,result`| Default tab to display |
39+
themeId | `string` | `false` | `dark` | Theme for the pen |
40+
preview | `boolean`| `false` | `true` | Make the preview "Click-to-Load" |
41+
title | `string` | `false` | | Title of the pen |
42+
43+
44+
## API
45+
46+
#### `Props.loader`
47+
Compenent to render when the pen is being embedded or when it errors.
48+
49+
```js
50+
<Codepen
51+
hash="JyxeVP"
52+
user="shettypuneeth"
53+
loader={() => <div>Loading...</div>}
54+
/>
55+
```
56+
57+
If the embed fails then the loader component will receive an error prop
58+
59+
```js
60+
const Loading = (props) {
61+
if (props.error) {
62+
return (
63+
<div>Error</div>
64+
);
65+
} else {
66+
return (
67+
<div>Loading...</div>
68+
);
69+
}
70+
}
71+
```

0 commit comments

Comments
 (0)