Code Block Copy
Code block with copy button and feedback
npm i @neddev/ui
import { Button } from '@neddev/ui'How to use it
- Paste the HTML where the components should appear.
- Add the CSS to your stylesheet. All classes are prefixed, so nothing clashes with your own styles.
- Add the JavaScript and call init() with the element that contains the HTML.
<!-- Code Block Copy · Bron: Cult UI · licentie MIT. Laat deze vermelding staan bij hergebruik. -->
<div class="jouw-container">
<div class="cdc"><div class="cdc-bar"><span class="cdc-dot"></span><span class="cdc-dot"></span><span class="cdc-dot"></span><span class="cdc-name">install.sh</span><button class="cdc-cp"><span class="cdc-cplab">Kopieer</span></button></div><pre class="cdc-pre"><code>npm i @neddev/ui
import { Button } from '@neddev/ui'</code></pre></div>
</div>/* Code Block Copy · Bron: Cult UI · licentie MIT. Laat deze vermelding staan bij hergebruik. */
.cdc{width:360px;background:#0a0a0a;border-radius:14px;overflow:hidden;font-family:'JetBrains Mono',monospace;box-shadow:0 14px 30px -18px rgba(10,10,10,.7)}
.cdc-bar{display:flex;align-items:center;gap:6px;padding:10px 14px;border-bottom:1px solid rgba(255,255,255,.08)}
.cdc-dot{width:9px;height:9px;border-radius:50%;background:rgba(255,255,255,.25)}
.cdc-name{margin-left:8px;font-size:11px;color:rgba(255,255,255,.55);font-family:'Switzer',sans-serif}
.cdc-cp{margin-left:auto;padding:5px 11px;border:1px solid rgba(255,255,255,.18);background:rgba(255,255,255,.06);color:#fff;border-radius:8px;font-size:11px;font-family:'Switzer',sans-serif;font-weight:600;cursor:pointer;transition:.2s}
.cdc-cp:hover{background:rgba(255,255,255,.12)}.cdc-cp.done{background:#F5480F;border-color:#F5480F}
.cdc-pre{margin:0;padding:16px;font-size:12.5px;line-height:1.7;color:#e6e6e6;white-space:pre-wrap}.cdc-pre code{color:#e6e6e6}// Code Block Copy · Bron: Cult UI · licentie MIT. Laat deze vermelding staan bij hergebruik.
// root = het element waarin de HTML staat
function init(root){
root=root.querySelector('.cdc')||root;var btn=root.querySelector('.cdc-cp'),lab=root.querySelector('.cdc-cplab'),code=root.querySelector('code').textContent;btn.addEventListener('click',function(){function done(){btn.classList.add('done');lab.textContent='Gekopieerd';setTimeout(function(){btn.classList.remove('done');lab.textContent='Kopieer';},1600);}if(navigator.clipboard&&navigator.clipboard.writeText){navigator.clipboard.writeText(code).then(done).catch(done);}else done();});
}
init(document.querySelector('.jouw-container'));
More components
Seen something you like?
Add it to your selection and send it over. We build your site around it, in your brand.
Get in touch →