npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cas-smartdesign/button

v7.1.14

Published

A button element which encloses the look and feel of the smartdesign button

Readme

@cas-smartdesign/button

A button element which encloses the look and feel of the SmartDesign 3.0 button.

This element must be used together with the design tokens of SmartDesign. For an independent application, make sure to include the @cas-smartdesign/design-tokens package. For a web app / web widget, refer to the official documentation about design token usage.

Attributes

  • icon: string
    • Defines the icon of the button
  • disabled: boolean
    • Defines whether if the button is disabled. Note that it uses default disabled attribute, thus blocking pointer/mouse events.
  • type: string
    • Can be set to either submit or reset to make the button act like a HTML form button.
  • variant: string
    • Defines the visual style of the button. One of primary, outline, standard, ghost, outline-danger, ghost-danger, selection, custom or contrast. Defaults to standard when unset or set to an unknown value.
  • aria-pressed: boolean
    • Marks a selection button as selected (standard toggle-button semantics). When the variant is set to selection and the attribute is absent, the button initializes it to false so assistive tools announce it as a toggle; the consumer flips it to true/false.

Properties

  • disabled: boolean
    • Makes the button looks like it is disabled & also prevents click events but used with a classname so mouse events are still triggered thus allowing for example tooltip usage in all browsers.
  • variant: ButtonVariant
    • Gets or sets the button's visual style (primary, outline, standard, ghost, outline-danger, ghost-danger, selection, custom or contrast). Reading it returns standard when the variant attribute is missing or invalid.

CSS Custom Properties

  • --sd-button-content-padding
    • Defines the value of margin-left, margin-right (default is 8px)
  • --sd-button-max-icon-size
    • Defines the value of max-width, max-height (default is 32px)

Colors & border

Each variant sets sensible defaults for these. Override them to fully customize a variant, or to style the custom variant which sets none of them itself. Each property falls back to a smartdesign design token when unset.

The selection variant additionally re-points these properties while selected ([aria-pressed="true"]): the background and border switch to the selection accent tokens, and the hover state is pinned to the selected colors so the selected look survives the cursor. To customize the selected appearance, set the same --sd-button-* properties under your own [aria-pressed="true"] selector.

For the custom variant you only need to set the two rest colors — --sd-button-background-color and --sd-button-color. The hover and pressed states are derived from them automatically (the background darkens, the text color is kept), so a minimal override stays coherent. You can still pin any individual state by setting its --sd-button-* property explicitly.

Mind the color contrast when relying on the derived states: because the background darkens while the text color is kept, a --sd-button-color that contrasts well against the rest background may fall below the required contrast ratio against the darker hover/pressed background. If the derived states do not meet your contrast requirements, set --sd-button-color-hover and --sd-button-color-pressed (and the matching background properties) explicitly.

The contrast variant is transparent at rest and derives its foreground automatically from the surface it sits on. Point --sd-button-contrast-source at the color behind the button (it defaults to the themed page background --color-bg-default, so it already follows the light/dark theme). The derived color is exposed as --sd-button-contrast-color and kept across every state — the foreground never changes. The :focus-visible outline is colored from the same derived foreground so the focus ring stays legible on dark surfaces.

  • --sd-button-contrast-source
    • (contrast variant) The surface color behind the button, used to derive a legible foreground and the hover/pressed shades. Defaults to --color-bg-default.
  • --sd-button-contrast-color
    • (contrast variant) The derived foreground color (computed from --sd-button-contrast-source). Used for the text/icon color in every state. Override to pin the foreground.
  • --sd-button-background-color
    • Background color in the default (rest) state.
  • --sd-button-color
    • Foreground (text/icon) color in the default state.
  • --sd-button-border
    • The border shorthand applied to the button (e.g. 1px solid …). Used by the outline variants.
  • --sd-button-background-color-hover
    • Background color on hover/focus.
  • --sd-button-color-hover
    • Foreground color on hover/focus.
  • --sd-button-border-color-hover
    • Border color on hover/focus (defaults to transparent).
  • --sd-button-background-color-pressed
    • Background color while pressed (:active).
  • --sd-button-color-pressed
    • Foreground color while pressed.
  • --sd-button-border-color-pressed
    • Border color while pressed (defaults to transparent).
  • --sd-button-background-color-disabled
    • Background color when disabled.
  • --sd-button-color-disabled
    • Foreground color when disabled.
  • --sd-button-border-color-disabled
    • Border color when disabled (defaults to transparent).
  • --sd-button-outline-color
    • Color of the :focus-visible outline. Defaults to --color-border-interaction-focus; the contrast variant points it at --sd-button-contrast-color.

SCSS mixins

The package ships SCSS mixins so a consumer app can apply the SmartDesign button look to its own elements (e.g. a native <button>), reusing the exact same variant definitions as the web component.

@use "@cas-smartdesign/button/scss/button" as sd-button;

button.cta {
  @include sd-button.button(primary);
}

// compose if you only want the variant colors onto an already-laid-out element
.danger {
  @include sd-button.appearance;
  @include sd-button.variant("outline-danger");
}

Available mixins:

  • button($variant: standard) — full look (layout + colors + variant). The default standard needs no variant. For selection it also emits the selected-state rules under [aria-pressed="true"] (you manage the attribute yourself on a native element).
  • base — structural styling only (layout, focus ring, disabled cursor), no colors.
  • appearance — the color engine (rest + hover/focus + pressed + disabled), driven by the --sd-button-* properties.
  • variant($name) — sets the --sd-button-* values for a named variant.
  • selection-checked — the selected-state rules of the selection variant (under [aria-pressed="true"]); include it alongside variant("selection") when composing manually instead of using button(selection).

Notes:

  • Resolving @use "@cas-smartdesign/button/scss/button" requires the consumer's build to resolve packages in Sass.
  • Themed colors resolve through the @cas-smartdesign/design-tokens CSS custom properties; without them, the built-in hex fallbacks apply. Consumers keep the same --sd-button-* override knobs documented above.