diff --git a/index.html b/index.html index 44d4b48..0b03eb2 100644 --- a/index.html +++ b/index.html @@ -48,6 +48,7 @@
  • Card Gruppe mit Tastennavigation
  • Formular mit Abschnitten
  • Multiselektions-Pulldown
  • +
  • Aktivierungs-Schalter (an/aus)
  • Text Layouts
  • diff --git a/patterns/aktivierungs-schalter.html b/patterns/aktivierungs-schalter.html new file mode 100644 index 0000000..fd0cdca --- /dev/null +++ b/patterns/aktivierungs-schalter.html @@ -0,0 +1,53 @@ + + + + + + Styleguide – Pattern Aktivierungs-Schalter + + + + +

    Pattern – Aktivierungs-Schalter

    +
    +

    Pattern: Aktivierungs-Schalter (an/aus)

    + +
    +
    +

    Pattern Demo

    +
    + + Status: aus +
    +
    +
    +
    + + + + + diff --git a/styleguide.css b/styleguide.css index 43b97ef..e51cb7e 100644 --- a/styleguide.css +++ b/styleguide.css @@ -1769,6 +1769,70 @@ section + section { } } +/* ========================================================= */ +/* Patterns: Aktivierungs-Schalter */ +/* ========================================================= */ + +.sg-activation-toggle-pattern { + display: flex; + align-items: center; + gap: var(--spacing-small); +} + +.sg-activation-toggle-pattern__label { + margin: 0; + color: var(--text-control-default); +} + +.sg-activation-toggle-chip { + position: relative; + display: inline-grid; + grid-template-columns: 1fr 1fr; + align-items: center; + min-width: calc(var(--layout-mode-toggle-local-height) * 3); + height: var(--layout-mode-toggle-local-height); + padding: var(--border-width-thin); + border: var(--border-none); + border-radius: var(--radius-interaction); + background: var(--surface-toggle-track); + color: var(--text-control-default); + font-family: var(--font-family-base); + font-size: var(--font-size-small); + font-weight: var(--font-weight-semibold); + line-height: 1; + cursor: pointer; + -webkit-appearance: none; + appearance: none; +} + +.sg-activation-toggle-chip::before { + content: ""; + position: absolute; + top: var(--border-width-thin); + left: var(--border-width-thin); + width: calc(50% - var(--border-width-thin)); + height: calc(100% - (var(--border-width-thin) * 2)); + border-radius: calc(var(--radius-interaction) - var(--border-width-thin)); + background: var(--surface-toggle-handle); + transition: transform 160ms ease; +} + +.sg-activation-toggle-chip[data-active="an"]::before { + transform: translateX(100%); +} + +.sg-activation-toggle-chip__text { + position: relative; + z-index: 1; + text-align: center; + text-transform: lowercase; +} + +.sg-activation-toggle-chip:focus, +.sg-activation-toggle-chip:focus-visible { + outline: none; +} + /* ========================================================= */ /* Patterns: Object Card */ /* ========================================================= */