Resources

Combos

One feature that comes in more than one form: a ready-made component, an attachment for any element, or both working together.

[ Alert - Combo ]

Feedback after something happens. The Alert component is one message. alerts.show() puts an alert on screen from anywhere (a form, a button) and stacks several in a column, newest at the bottom, each closing on its own. <AlertStack /> is mounted once in the site layout; to remove alerts, delete it, alert.svelte and utils/alerts.svelte.ts.

Available props:

  • title A string. Required.
  • message A string under the title.
  • type success | info | warning | error. Sets the icon and color. Defaults to info.
  • links An array of up to two Button props ({ text, url, newTab }), shown as underline links under the message.
  • autoClose A number, milliseconds before the alert closes itself. 0 keeps it until it is closed. Hovering or focusing an alert holds the countdown. Defaults to 0.
  • timer A boolean. Shows a line that runs out as the alert closes. Needs autoClose. Defaults to false.
  • leftBorder A boolean. A thick border in the alert color down the left edge. Defaults to false.

Alert Component Static

The component on its own, for a message that belongs in the page.

Message received!

We will get back to you shortly.

Heads up

This is some helpful information.

alerts.show() Stacked

Press a few of these quickly: the alerts stack in the bottom right instead of covering one another. Hover one to hold its countdown.

[ Clipboard Copy - Combo ]

Copy a string to the visitor's clipboard, and tell them it worked. The copy attachment does it for any element you click, with a label that briefly changes and a spoken confirmation. The CopyButton component is a ready-made button that uses it.

Copy Button Component

A Button that copies a string, or the text of another element. It says Copied! for a moment, and can show an alert.

Available props:

  • text A string to copy.
  • target A selector or element to copy from instead of text (see the copy options).
  • label A string, the button label. Defaults to Copy.
  • copiedText A string the label changes to after copying. Defaults to Copied!.
  • copiedTime A number, milliseconds the copied state lasts. Defaults to 2000.
  • icon An icon name from static/icons, shown before the label. Defaults to copy.
  • type solid | outline | underline | text. A Button type. Defaults to outline.
  • size sm | md | lg. Defaults to sm.
  • alert Alert options, to show an alert on copying (see the copy options).
  • onCopy A function called with the copied text.
  • class A string of extra classes.

Or copy the text of another element on the page by pointing `target` at it:

bun add gsap lenis

copy Attachment

Makes any element copy on click. If the element has a .label (as Button does) that is what changes; otherwise its own text.

Available props:

  • text A string, or a function that returns one, to copy.
  • target A selector or element to copy from instead of text. It copies the element's data-copy-value if it has one, otherwise its text.
  • copiedText A string the label changes to right after copying, such as Copied!. Without it the label does not change.
  • copiedTime A number, milliseconds the copied state lasts. Defaults to 2000.
  • alert Alert options (title, message, autoClose and so on). When set, an alert from the Alert combo shows on copying.
  • onCopy A function called with the copied text.
Copy the time

[ Tabs - Combo ]

Show one panel at a time. Two ways to build them, one for ready-made panels and one for your own markup. Both are real tabs: they work with the arrow keys, Home and End, and tell screen readers which tab is selected.

Tabs Component Ready-made panels

Each panel is a title, a description and an optional image, laid out for you.

Available props:

  • tabs An array of { label, title, description, image }. label is the tab button, and image is { src, alt }. Required.
  • defaultTab A number, the tab that starts selected, counting from 0. Defaults to 0.
  • variant underline | solid. A line under the selected tab, or a filled tab. Defaults to underline.
  • class A string of extra classes.

Design

Layouts that feel simple and look sharp.

Pay yearly

Two months free when you pay for the year.

tabs Attachment

Turns your own markup into tabs. Put a role="tablist" of role="tab" buttons and the same number of role="tabpanel" elements inside the element, and put the attachment on it. The panels can hold anything. It links the ids, shows one panel at a time and handles the keyboard. Style the selected tab with [aria-selected='true'], or add the Toggle Slider attachment to the tablist, as here, for a slider behind it.

Available props:

  • defaultTab A number, the tab that starts selected, counting from 0. Defaults to the first panel that is not hidden, else the first.
  • onChange A function called with the new tab number whenever the selection changes.
$12 a month. One seat, every feature.
  • Up to ten seats
  • Shared workspaces
  • Priority support

[ Tooltip - Combo ]

A tooltip can be added in two ways, each with different pros and cons.

Tooltip Component Stationary

tooltip.svelte opens on hover or keyboard focus, closes with Escape, and links its message to the trigger for screen readers.

Available props:

  • message A string, the text in the bubble. Required.
  • text A string that triggers the tooltip. Without it an icon does.
  • icon An icon name for the trigger. Defaults to info-circle.
  • size xs | sm | md | lg. The width of the bubble. Defaults to md.
  • place top | top-right | top-left | bottom | bottom-right | bottom-left | left | right. Where the bubble sits on desktop. Defaults to top.
  • placeSm The same options without left and right, used below the lg breakpoint. Defaults to top.
  • includePoint A boolean. Adds a small pointer to the bubble.
Sample message for tooltip 1. This is using the default props, but uses size sm. Tooltip 2 message. This uses the text prop for the trigger. It also positions the message bubble to the right of the trigger.

Does this work inline? Sample message for tooltip 3. This is the lengthy text example. Crazy how much text we can have here. Will it still work through? That is the right question to ask in cases like this. Hopefully we can cover all the edge cases to make this component solid and reusable for future projects. This uses size lg and place bottom-right. then some text afterward.

Tooltip Attachment Follows the mouse

mouseTooltip turns any element into a trigger. The bubble follows the mouse and moves to the other side of it near the edges of the screen. On keyboard focus or click it sits under the element until the mouse moves, and it hides while scrolling. It does not need the custom cursor.

Available options:

  • message A string, the text in the bubble. Required.
  • minWidth A number, the minimum width of the bubble in px. Defaults to 280.
  • tilt A boolean or tilt options (max, reverse, velocityMax, inSpeed, outSpeed, idleMs).

Tooltip attachment . The bubble is meaning it moves itself if it is too close to the edge of the screen.

[ Video Background - Combo ]

Put a video behind any section, container or element. Give the wrapper the class video-bg and place video-bg.svelte inside it, after the content. The wrapper becomes its own stacking context that clips the video, and a play / pause button sits in a corner. Videos autoplay muted and looping, but stay still for visitors who prefer reduced motion.

Available props:

  • src A string, the video file. Self-hosted or CDN files are best. Required.
  • poster A string, an image shown before the video plays. Best paired with autoplay: false.
  • autoplay A boolean. Plays on its own, muted and looping, unless the visitor prefers reduced motion. Defaults to true. On mobile, a video that is not autoplaying needs a poster.
  • shadow top | bottom | null. A dark gradient over the video to help text stand out. Defaults to bottom.
  • placement br | bl | tr | tl. The corner of the play / pause button. Defaults to br.
  • toggleAttach An attachment for the button, such as magnet().
  • title A string, the video's accessible name. Defaults to Background video.

Video Background

Minimal setup, maximum impact. Just add a class and tuck the component at the bottom, then watch the magic!

2.0 Variant

Shadow: top

Autoplay: false

Space

Simply remarkable