Skip to content
Klarhimmel UI

Floating actions

Floating actions previewFloating actions preview

Install

npx shadcn add https://ui.klarhimmel.com/r/floating-actions.json
DetailsAbout, usage, props and more

A pill with a quiet link and the main action, centred on its own band so the one thing to do stays in reach. Sits in the flow of its section, never fixed over the page.

Import

Import

import Block from '@/components/klarhimmel/blocks/floating-actions';
Also called
  • banner/floating-actions
About
A pill with a quiet link and the main action, centred on its own band so the one thing to do stays in reach. Sits in the flow of its section, never fixed over the page. Empty secondary label drops the link.
Category
Announcement bars and the cookie notice. New project? Set it up once: /get-started/installation.

Notes

When to use it

A small pill with one quiet link and one filled button, centred on its own band so the single thing to do stays in reach. Use cta-minimal when the closing step needs a heading and a sentence around it.

Writing for it

- Give the filled button the action you most want taken and the quiet link the softer alternative, such as reading more before booking. - Leave the secondary label empty to drop the link, and the pill shrinks to the button alone. - The group label is read by screen readers and never drawn, so write it as what the pair of actions is for.

Watch out for

It sits in the flow of its section and is never fixed over the page, so it does not follow the visitor while they scroll. A page that needs a sticky bar has to add that outside the block.

Usage

The block in a page, with its default content (long lists shortened). Every prop is in the table below.

section.tsx
import { Theme } from '@/components/klarhimmel/theme/style';
import { BlockSurface } from '@/components/klarhimmel/blocks/surface';
import FloatingActions from '@/components/klarhimmel/blocks/floating-actions';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <FloatingActions props={{
          "label": "Name what these actions are for",
          "secondary": {
            "label": "A second way in",
            "href": "#more"
          },
          "primary": {
            "label": "Main action",
            "href": "#start"
          }
        }} />
      </BlockSurface>
    </Theme>
  );
}

Props

The type, default and text limit of every prop. On a real page, over-limit text is kept and checkSections flags it (Installation, Check a page before you ship); this live preview shows the default until it fits. The panel above edits all props.

PropTypeDefaultDescription
labelstring'Name what these actions are for'Text, up to 40 characters.
secondaryLink{…}See the type.
primaryLink{…}See the type.