Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <!DOCTYPE html>
<html lang="en" class="no-js">

<head>
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Data Grid Demo</title>

  <link rel="modulepreload" href="https://cdn.jsdelivr.net/npm/last-icon@1/last-icon.js">
  <script type="module" src="https://cdn.jsdelivr.net/npm/last-icon@1/last-icon.js"></script>
  <script type="module" src="https://cdn.jsdelivr.net/gh/lekoala/data-grid/data-grid.min.js"></script>

  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/last-icon@1/last-icon.css">
  <!-- include bootstrap just to make sure it doesn't conflict with our styles -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5/dist/css/bootstrap.min.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/mvp.css@1/mvp.css" />
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/lekoala/data-grid/data-grid.min.css" />

  <style type="text/css">
    .text-center {
      text-align: center;
    }

    .expand-cell {
      white-space: normal;
    }

    .highlight-col {
      background-color: palegoldenrod;
    }

    tr.approved td {
      background-color: paleturquoise;
    }

    tr.pending td {
      background-color: azure;
    }
  </style>
</head>

<body>
  <header>
    <h1>
      Data Grid</h1>
    <p><em>Standalone data grid web component</em></p>
  </header>
  <main>
    <h2>Basic usage</h2>
    <p>Url should point to a json file that return a plain array or a json response with a <code>data</code> key that contains an array</p>

    <ul>
      <li><code>sticky</code> to enable stick headers and footers</li>
    </ul>
    <data-grid url="https://cdn.jsdelivr.net/gh/lekoala/data-grid/demo.json" sticky expand></data-grid>

    <h2>Scrollable</h2>

    <ul>
      <li><code>scrollable</code> to enable scrollable table. Can be useful for large tables.</li>
    </ul>
    <data-grid url="https://cdn.jsdelivr.net/gh/lekoala/data-grid/demo.json" scrollable></data-grid>

    <h2>Responsive</h2>

    <ul>
      <li><code>responsive</code> to enable responsive table.</li>
    </ul>
    <data-grid url="https://cdn.jsdelivr.net/gh/lekoala/data-grid/demo.json" responsive></data-grid>

    <h2>More options</h2>
    <ul>
      <li><code>filter=true</code> to enable filtering</li>
      <li><code>sort=true</code> to enable sorting</li>
      <li><code>default-sort=field</code> to set a default sort order</li>
      <li><code>reorder=true</code> to drag columns</li>
    </ul>
    <data-grid url="https://cdn.jsdelivr.net/gh/lekoala/data-grid/demo2.json" filter="true" sort="true" reorder="true" default-sort="id" debug="true" sticky></data-grid>

    <h2>Good to know</h2>

    <p>Url can return either a plain array or a structured object with a `data` key containing the response.</p>
    <p>The structured objects can also be used to configure the grid if needed using the `options` key. Check `demo2.json` for an example.</p>
  </main>
  <footer>
    <hr />
    Made with <l-i name="heart" set="em"></l-i> in <l-i name="be" set="fl"></l-i> by <a href="https://www.lekoala.be">LeKoala</a>
  </footer>
</body>

</html>
              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console