# create-codepen **Repository Path**: Mister-Hope/create-codepen ## Basic Information - **Project Name**: create-codepen - **Description**: Create codepen through api - **Primary Language**: TypeScript - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-02-23 - **Last Updated**: 2024-12-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # create-codepen A library creating codepen with api. ## loadCodePens Load codepen through dom, this should be the same as the codepen embed script, while we are not calling `loadCodePen(".codepen")` directly. ```ts export const loadCodePens: (selector = ".codepen") => void; ``` Example: ```html

See the Pen Walkers - How to by Louis Hoebregts (@Mamboleoo) on CodePen.

``` ## openCodePens Open codepen in new window ```ts export const openCodePens: (selector?: string) => void; ``` Example: ```html

See the Pen Walkers - How to by Louis Hoebregts (@Mamboleoo) on CodePen.

``` ## renderCodePen Generate a codepen iframe through options. If a valid selector is provided, the codepen will be rendered inside selector element. Otherwise it will be rendered in new window. ```ts interface CodePenStyleOptions { /** * @default 300 */ height?: number | string; /** * @default none */ border?: "none" | "thin" | "thick"; /** * @default #000000 */ "border-color"?: string; /** * @default #3d3d3e */ "tab-bar-color"?: string; /** * @default #76daff */ "tab-link-color"?: string; /** * @default #cccccc */ "active-tab-color"?: string; /** * @default #000000 */ "active-link-color"?: string; /** * @default #ffffff */ "link-logo-color"?: string; /** * Additional class name */ class?: string; "custom-css-url"?: string; } interface CodePenDomOptions extends CodePenStyleOptions, Record { /** * Id of theme * @default 0 */ "theme-id"?: string | number; "slug-hash"?: string; user?: string; /** * @description one of or a set of "html" | "css" | "js" | "result" * @default "result" */ "default-tab"?: string; animations?: "run" | "stop-after-5"; preview?: "true" | "false"; /** * @default 1 */ zoom?: 1 | 0.5 | 0.25; token?: string; "pen-title"?: string; /** * @deprecated use "slug-hash" instead */ href?: string; /** * @deprecated use "animations" instead */ safe?: "true"; /** * @deprecated use "default-tab" instead */ type?: string; /** @private */ name?: string; } interface CodePenPrefillOptions { title?: string; description?: string; head?: string; tags?: string | string[]; html_classes?: string | string[]; stylesheets?: string | string[]; scripts?: string | string[]; } interface CodePenOptions extends Omit { /** @private */ data?: string; prefill?: CodePenPrefillOptions; /** * @default "false" */ editable?: "true" | "false"; } export const renderCodePen: ( options: CodePenOptions, selector?: string | HTMLElement, ) => void; ``` Example: ```html
```