Slide: Playground

The "Playground" template helps embed easily playgrounds as Codepen, JSFiddle and WebComponents.dev in your presentation.

Table of contents

Layout

My Codepen

0%0/0

Installation

This template could be added to your presentation using the following methods.

If you are using our Starter Kit, no need to worry about this, this template is included, therefore you could skip the "Installation" chapter.

From a CDN

It's recommended to use unpkg if you want to use this template from a CDN. To do so, add the following include script in the main HTML file of your project:

<script type="module" src="https://unpkg.com/@deckdeckgo/slide-playground@latest/dist/deckdeckgo-slide-playground/deckdeckgo-slide-playground.esm.js"></script> <script nomodule="" src="https://unpkg.com/@deckdeckgo/slide-playground@latest/dist/deckdeckgo-slide-playground/deckdeckgo-slide-playground.js"></script>

From NPM

To install this template in your project from npm run the following command:

npm install @deckdeckgo/slide-playground

Framework integration

The Stencil documentation provide examples of framework integration for Angular, React, Vue and Ember.

That being said, commonly, you might either import or load it:

Import

import '@deckdeckgo/slide-playground';

Loader

import { defineCustomElements as deckDeckGoSlideElement } from '@deckdeckgo/slide-playground/dist/loader'; deckDeckGoSlideElement();

Usage

The "Playground" slide's Web Component could be integrated using the tag <deckgo-slide-playground/>.

<deckgo-slide-playground src="https://codepen.io/peterpeterparker/pen/dyGbOZm"> <h1 slot="title">My Codepen</h1> </deckgo-slide-playground>

Slots

Both slots title and content are optional.

Attributes

This component offers the following options which could be set using attributes:

AttributeTypeDefaultDescription
srcstringThe full link to your Pen, Fiddle oder WebComponents.dev. The component will take care of converting the link to an embeddable one.
theme'default' or 'light' or 'dark''defaultThe theming option if it can be applied respectivelly if supported by the third party playground, otherwise, 'default'.
widthnumberPer default the playground width will be calculated according the content size available.Using this option you would be able to define your own width.
heightnumberPer default the playground height will be calculated according the content size available.Using this option you would be able to define your own height.
custom-backgroundbooleanfalseIf you would provide a background for the all deck and a specific one for this slide, set this option to true
custom-actionsbooleanfalseIf you would provide actions for the all deck and a specific one for this slide, set this option to true

Theming

The following theming options will affect this component if set on its host or parent.

CSS4 variableDefaultNote
--background
--color
--slide-padding-top16pxPadding top of the all slide
--slide-padding-end32pxPadding right of the all slide
--slide-padding-bottom16pxPadding bottom of the all slide
--slide-padding-start32pxPadding left of the all slide
--zIndex1The z-index of the slide
--slide-playground-margin32px 0 32pxThe margin of the playground's container
--slide-playground-heightcalc(100% - 32px)The height of the playground's container
--slide-playground-overflowautoThe overflow of the playground's container