Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <div class='Wrapper'>
  <github-repo name="yzw7489757/single-spa-demo"></github-repo>
  <github-repo name="yzw7489757/react-middleware"></github-repo>
  <github-repo name="yzw7489757/like-hooks"></github-repo>
  <github-repo name="yzw7489757/tms-editor"></github-repo>
  <github-repo name="yzw7489757/react-interactive-paycard"></github-repo>


                .Wrapper {
  margin: 1rem auto;
  max-width: 600px;
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: system-ui;



                var getRandomColor = function(){
    return '#'+(Math.random()*0xffffff<<0).toString(16); 
class Repository extends HTMLElement {
  constructor() {
    this.color = getRandomColor()
    this.repoDetails = null; = this.getAttribute("name");
    this.endpoint = `${}`;
    this.innerHTML = `<h1>Loading</h1>`;

  async connectedCallback() {
    this.repoDetails = await this.getDetails();

  initShadowDom() {
    let shadowRoot = this.attachShadow({ mode: "open" });
    shadowRoot.innerHTML = this.template;

  get style() {
    return `
        .Card {
          margin: 0 0 8px;
          padding: 16px;
          border: 2px solid ${this.color};

        .Card::after {
          content: "";
          clear: both;
          display: table;

        .Card aside {
          float: left;

        .Card header {
          float: left;

        .Card__title {
          margin-bottom: 4px;
          font-weight: 400;
          font-size: 16px;

        .Card__meta {
          color: #4F4F4F;
          font-size: 12px;

        .Card--error {
          background: #D23923;
          color: white;
          font-weight: 700;
          border: 0;

        .Avatar {
          display: block;
          margin-right: 16px;
          border-radius: 50%;

  get template() {
    let repo = this.repoDetails;

    if (repo.message) {
      return + this.cardError(repo);
    } else {
      return + this.cardTemplate(repo);

  getDetails = async () => {
    return await fetch(this.endpoint, { mode: "cors" }).then(res => res.json());

  cardError({ message }) {
    return `<div class="Card Card--error">Error: ${message}</div>`;

  cardTemplate({ owner, full_name, description }) {
    return `
      <div class="Card">
          <img width="48" height="48" class="Avatar" src="${
          }" alt="Profile picture for ${owner.login}" />
          <h2 class="Card__title">${full_name}</h2>
          <span class="Card__meta">${description}</span>

window.customElements.define("github-repo", Repository);