shimmer-button
A primary button with a band of light sweeping across it, for the one action that should draw the eye. A native <button> (or a link with href), so forms and keyboards work; the sweep pauses on hover and stops under reduced motion.
This one has no events: it shows what it's given.
Source: shimmer-button.zb, and its registry item.
Install
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/shimmer-button.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/shimmer-button.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/shimmer-button.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/shimmer-button.json
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/shimmer-button.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/shimmer-button.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/shimmer-button.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/shimmer-button.json
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/shimmer-button.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/shimmer-button.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/shimmer-button.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/shimmer-button.json
<link rel="stylesheet" href="https://zubra-js.github.io/zubra-ui/themes/default.css">
<script type="module" src="https://zubra-js.github.io/zubra-ui/cdn/shimmer-button.js"></script>The compiled install writes src/components/zubra/shimmer-button.js and the theme, and adds @zubra/runtime to your dependencies. The one-file install writes the same path as a plain custom element that needs nothing installed (or download it and load it with a <script type="module">); it's smaller on a page with one to three components, the shared runtime with more.
Usage
<shimmer-button type="button">
Book a class
</shimmer-button>
<script type="module">
import './components/zubra/shimmer-button.js';
</script>import './components/zubra/shimmer-button.js';
export function ShimmerButtonExample() {
return (
<shimmer-button type="button">
Book a class
</shimmer-button>
);
}<script setup>
import './components/zubra/shimmer-button.js';
</script>
<template>
<shimmer-button type="button">
Book a class
</shimmer-button>
</template>
<!-- vite.config.js: vue({ template: { compilerOptions: { isCustomElement: (tag) => tag.includes('-') } } }) --><script>
import './components/zubra/shimmer-button.js';
</script>
<shimmer-button type="button">
Book a class
</shimmer-button>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import './components/zubra/shimmer-button.js';
@Component({
selector: 'app-shimmer-button-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<shimmer-button type="button">
Book a class
</shimmer-button>
`,
})
export class ShimmerButtonExample {
}API
| Property | Type | Default |
|---|---|---|
type | "button" | "submit" | "reset" | "button" |
href | string | "" |
name | string | "" |
value | string | "" |
disabled | boolean | false |
| Slot | For |
|---|---|
(default) | The label. |
Size
1.1 KB gzipped for the component, plus the runtime, which every Zubra component on a page shares (up to 22.1 KB, all of it). On its own, with the parts of the runtime it uses, it's 17.3 KB.