nightdeck-ui
A dark control-panel UI kit for dashboards, settings screens and Electron apps. Plain JavaScript and CSS, about 6 KB gzipped, no dependencies.
Try it
Everything below is live: switch tabs (also with the arrow keys), move the sliders, press the presets. Every change is written to the console.
Quick start
npm install nightdeck-ui
or straight from a CDN, no install:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nightdeck-ui@0.1/dist/nightdeck.min.css"> <script src="https://cdn.jsdelivr.net/npm/nightdeck-ui@0.1/dist/nightdeck.min.js"></script>
<div id="app"></div>
<script>
const panel = Nightdeck.create("#app", {
title: "Settings",
tabs: {
display: [
{ type: "toggle", id: "vsync", label: "vertical sync", value: true },
{ type: "slider", id: "brightness", label: "brightness", value: 60 }
]
},
onChange(id, value, all) { console.log(id, value, all); }
});
</script>
Item types
| type | what it is | value |
|---|---|---|
toggle | on/off switch | true / false |
slider | range with min, max, step, unit | number |
select | dropdown with options | string |
text | text field with placeholder | string |
button | fires an action event, variant: "accent" | "danger" | - |
meter | progress bar, turns warn colour above warn (50) and full colour at 100 | 0-100 (display) |
info | label and value row | text (display) |
custom | your own content: render(element, panel) | - |
Full API, theming and browser support: see the README.