Skip to content

Commit 4e363f5

Browse files
authored
feat: add typings (#7)
1 parent 9e3cc91 commit 4e363f5

2 files changed

Lines changed: 54 additions & 1 deletion

File tree

index.d.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
declare module 'react-codepen-embed' {
2+
import * as React from 'react';
3+
4+
export interface Props {
5+
/**
6+
* The Id of the pen to embed
7+
*/
8+
hash: string;
9+
10+
/**
11+
* CodePen username
12+
*/
13+
user: string;
14+
15+
/**
16+
* Height of the pen
17+
* @default 300
18+
*/
19+
height?: number;
20+
21+
/**
22+
* Loader to render while the pen is being embedded or errors out
23+
*/
24+
loader?: React.ReactNode;
25+
26+
/**
27+
* Default tab to display
28+
* @default 'css,result'
29+
*/
30+
defaultTab?: string;
31+
32+
/**
33+
* Theme for the pen
34+
* @default 'dark'
35+
*/
36+
themeId?: string;
37+
38+
/**
39+
* Make the preview 'Click-to-Load'
40+
* @default true
41+
*/
42+
preview?: boolean;
43+
44+
/**
45+
* Title of the pen
46+
*/
47+
title?: string;
48+
}
49+
50+
const ReactCodepen: React.FC<Props>;
51+
export default ReactCodepen;
52+
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@
3131
},
3232
"peerDependencies": {
3333
"react": "^16.8.0"
34-
}
34+
},
35+
"types": "./index.d.ts"
3536
}

0 commit comments

Comments
 (0)