Zubra UI
Code for
GitHub

spotlight-card

A card lit by a soft spotlight that follows the pointer, in the theme's primary colour at strength. An ordinary card on touch screens.

Timers per step

Proofs and bakes run side by side, with an alert for each.

This one has no events: it shows what it's given.

Source: spotlight-card.zb, and its registry item.

Install

Compiled (any project)
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/spotlight-card.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/spotlight-card.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/spotlight-card.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/spotlight-card.json
One file, no dependencies (3.6 KB gzipped)
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/spotlight-card.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/spotlight-card.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/spotlight-card.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/spotlight-card.json
.zb source (to edit it with Zubra)
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/spotlight-card.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/spotlight-card.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/spotlight-card.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/spotlight-card.json
No build: a script tag, straight from this site
HTML
<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/spotlight-card.js"></script>

The compiled install writes src/components/zubra/spotlight-card.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

index.html
<spotlight-card>
  <h3>Timers per step</h3>
  <p>Proofs and bakes run side by side, with an alert for each.</p>
</spotlight-card>

<script type="module">
  import './components/zubra/spotlight-card.js';

  const element = document.querySelector('spotlight-card');
  element.strength = 14;
</script>
Example.jsx
import './components/zubra/spotlight-card.js';

const strength = 14;

export function SpotlightCardExample() {
  return (
    <spotlight-card strength={strength}>
      <h3>Timers per step</h3>
      <p>Proofs and bakes run side by side, with an alert for each.</p>
    </spotlight-card>
  );
}
Example.vue
<script setup>
import './components/zubra/spotlight-card.js';
const strength = 14;
</script>

<template>
  <spotlight-card :strength.prop="strength">
    <h3>Timers per step</h3>
    <p>Proofs and bakes run side by side, with an alert for each.</p>
  </spotlight-card>
</template>

<!-- vite.config.js: vue({ template: { compilerOptions: { isCustomElement: (tag) => tag.includes('-') } } }) -->
Example.svelte
<script>
  import './components/zubra/spotlight-card.js';
  const strength = 14;
</script>

<spotlight-card {strength}>
  <h3>Timers per step</h3>
  <p>Proofs and bakes run side by side, with an alert for each.</p>
</spotlight-card>
example.component.ts
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import './components/zubra/spotlight-card.js';

@Component({
  selector: 'app-spotlight-card-example',
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  template: `
    <spotlight-card [strength]="strength">
      <h3>Timers per step</h3>
      <p>Proofs and bakes run side by side, with an alert for each.</p>
    </spotlight-card>
  `,
})
export class SpotlightCardExample {
  strength = 14;
}

API

Properties (each is also an HTML attribute of the same name, unless marked)
PropertyTypeDefault
strengthnumber14
Slots
SlotFor
(default)The card's content.

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.6 KB.

Theme

Every component reads shadcn/ui's CSS variables, so any shadcn theme works. Pick a look or a colour, or paste a theme's CSS.

Look: colours, fonts, corners and motion

Accent colour