Skip to content

CSS: button-set ​

.instui-button-set — En sammensyet (flush, ingen mellemrum) række af knapper, hvor kun de to yderste hjørner er afrundede.

Dens egne kædede modifikatorer (-color-*, -size-*, -shape-*, -toggle, -condensed, -without-background, -without-border, -display-block) angiver en standardværdi for hvert underordnet element .instui-button der ikke har sin egen modifikator i samme kategori — en knaps egen modifikatorklasse vinder altid over gruppens standardværdi. -icon-* gælder altid for den enkelte knap; den hentes aldrig fra gruppen. Forældede knapaliaser (-ghost, -color-primary-inverse) understøttes ikke som modifikatorer på gruppeniveau — brug i stedet deres kanoniske erstatninger (-color-tertiary, -on-color) i stedet. Hver sammenføjning viser en enkelt 1 px-søm i knappernes egen kantfarve (ensfarvede flader, hvor kanten matcher fyldfarven, farver sømmen med tekstfarven). -without-seam gælder kun for grupper: den skjuler sømmen, så knapperne fremstår som én sammenhængende kontrol. Placer -width-half på en individuel knap med kun ikon for at få en split-action-udløser med halvdelen af standardens kvadratiske bredde og hele knaphøjden.

Brug ​

css
@import "@pantoken/plugin-custom-components/custom-components.css";

Per-button override ​

html
<div class="instui-button-set -color-secondary">
  <button class="instui-button -icon-x">Annuller</button>
  <button class="instui-button -color-primary -icon-checkmark">Bekræft</button>
</div>

Flush (no seams) ​

html
<div class="instui-button-set -without-seam">
  <button class="instui-button">Dag</button>
  <button class="instui-button"> Uge 1</button>
  <button class="instui-button">Måned</button>
</div>

Split action ​

Put -width-half on only the icon-only trigger to give it half the standard square button's width, keeping the full height. The main action can have a text label or be an icon-only square button. Group sizes and per-button size overrides apply; the width isn't a fraction of the main action. Give the icon-only button an accessible name. This example shows layout only: wire the trigger to a real menu and manage its expanded state and focus in your application.

html
<div class="instui-button-set -color-primary" role="group" aria-label="Save actions">
  <button class="instui-button" type="button">Gem ændringer</button>
  <button class="instui-button -width-half -icon-chevron-down" type="button" aria-label="More save actions"></button>
</div>
<div class="instui-button-set -size-md" role="group" aria-label="Add actions">
  <button class="instui-button -shape-square -icon-plus" type="button" aria-label="Add"></button>
  <button class="instui-button -width-half -icon-chevron-down" type="button" aria-label="More add actions"></button>
</div>

Struktur ​

text
.instui-button-set
  button (component, 1..n)
flowchart TD n0[".instui-button-set"]:::cssdoc-root n1(["button"]):::cssdoc-component n0 -->|1..n| n1 click n1 "/api/css/button.md" classDef cssdoc-root stroke-width:1px; classDef cssdoc-part stroke-width:1px; classDef cssdoc-slot stroke-width:1px; classDef cssdoc-component stroke-width:1px;

Modifikatorer ​

ModifikatorBeskrivelse
.-color-aiSæt standarden for hvert uændrede barn til AI-gradientbehandlingen.
.-color-ai-secondarySæt standarden for hvert uændrede barn til den lavere-akkentuerede AI-behandling.
.-color-dangerSæt standarden for hvert uændrede barn til den destruktive farve.
.-color-primarySæt standarden for hvert uændrede barn til primærfarven.
.-color-secondarySæt standarden for hvert uændrede barn til sekundærfarven.
.-color-successSæt standarden for hvert uændrede barn til success-farven.
.-color-tertiarySæt standarden for hvert uændrede barn til tertiær (tekststil)) farven.
.-condensedSæt standarden for hvert uændrede barn til strammere polstring.
.-display-blockPlacér hvert uændrede barn i fuld bredde.
.-on-colorSæt standarden for hvert uændrede barn til placering på en farvet overflade.
.-shape-circleSæt standarden for hvert uændrede barn til en rund ikonknap.
.-shape-squareSæt standarden for hvert uændrede barn til en firkantet ikonknap.
.-size-lgSæt standarden for hvert uændrede barn til stor.
.-size-md(standard) mellemstørrelse.
.-size-smSæt standarden for hvert uændrede barn til lille.
.-toggleSæt standarden for hvert uændrede barn til tryk-tilstands toggle-behandlingen.
.-without-backgroundSæt standarden for hvert uændrede barn til ingen udfyldning.
.-without-borderSæt standarden for hvert uændrede barn til ingen kant.
.-without-seamSkjul 1px-sømmen mellem knapperne.

Pseudo-elementer ​

Pseudo-elementBeskrivelse
::after—
::before—

Tilstande ​

TilstandBeskrivelse
[aria-disabled="true"]—
[aria-pressed="true"]—
:disabled—

Tilgængelighed ​

Brug en gruppe med etiket til relaterede handlinger; når knapper repræsenterer et til/fra-valg, skal hver tilstand angives med aria-pressed. Giv knapper med kun ikon et tilgængeligt navn. Udløsere med halv bredde er smalle mål (16px, 20px eller 24px ved standardstørrelserne); sørg for tilstrækkelig afstand mellem målene, eller brug en kvadratisk knap i fuld bredde til touchgrænseflader.

Regler (axe-core)Nyt brand (lys)Nyt brand (mørk)CanvasCanvas høj kontrast
color-contrastWCAG 2.2 1.4.3Gennemgang nødvendigGennemgang nødvendigGennemgang nødvendigGennemgang nødvendig

Elementer skal opfylde minimumskravene til farvekontrastforhold

  • .-color-ai > button:nth-child(1)
  • .-color-ai-secondary > button:nth-child(1)
target-sizeWCAG 2.2 2.5.8FailFailFailFail

Alle berøringsmål skal være mindst 24px store eller have tilstrækkelig afstand

  • .-color-primary[aria-label="Save actions"][role="group"]:nth-child(19) > .-wi...
  • .-color-primary[aria-label="Save actions"][role="group"]:nth-child(22) > .-wi...
  • button[aria-label="More add actions"]
BetingelserNyt brand (lys)Nyt brand (mørk)CanvasCanvas høj kontrast
forced-colors-focus-visibleWCAG 2.2 1.4.11, 2.4.7PassPassPassPass
more-contrast-respectedWCAG 2.2 1.4.3, 1.4.6FailFailFailFail

Nyt design (lys): Med prefers-contrast: more falder seks tekststykker under minimumskontrasten. Den værste er "Send" ved 1.64:1 (kræver 4.5:1).

Nyt design (mørk): Med prefers-contrast: more falder seks tekststykker under minimumskontrasten. Den værste er "Send" ved 1.78:1 (kræver 4.5:1).

Canvas, Canvas High Contrast: Med prefers-contrast: more falder to tekststykker under minimumskontrasten. Den værste er "Rewrite" ved 1.88:1 (kræver 4.5:1).

reduced-motion-respectedWCAG 2.2 2.3.3, 2.2.2Ikke relevantPassPassIkke relevant
reduced-transparency-respectedWCAG 2.2 1.4.3, 1.4.11PassPassIkke relevantIkke relevant
reflow-at-320pxWCAG 2.2 1.4.10FailFailFailFail

I et 320px-vindue ruller siden sidelæns (den er 592px bred i et 320px-vindue)), og ét element rækker ud over højre kant: button.instui-button slutter ved 592px. WCAG 1.4.10 Reflow (niveau AA) undtager todimensionelt indhold såsom datatabeller og kort, så man bør vurdere, om det er relevant.

text-spacing-no-clippingWCAG 2.2 1.4.12PassPassPassPass
Skærmlæser (simuleret)Nyt brand (lys)Nyt brand (mørk)CanvasCanvas høj kontrast
AnnouncementsPassPassPassPass

Disse automatiserede resultater dokumenterer ikke, at siden overholder WCAG; manuel gennemgang er stadig nødvendig.

Forbrugte tokens ​

TokenTypeVærdi
--instui-border-width-md<length>0.125rem
--instui-border-width-sm<length>0.0625rem
--instui-color-background-interactive-action-ai-bottom-gradient-active<color>#01626E
--instui-color-background-interactive-action-ai-bottom-gradient-base<color>#027887
--instui-color-background-interactive-action-ai-bottom-gradient-hover<color>#00828E
--instui-color-background-interactive-action-ai-secondary-active-bottom-gradient<color>LightDarklight-dark(#CFF0F6, #00424A)
--instui-color-background-interactive-action-ai-secondary-active-top-gradient<color>LightDarklight-dark(#F3E5F7, #522965)
--instui-color-background-interactive-action-ai-secondary-hover-bottom-gradient<color>LightDarklight-dark(#CFF0F6, #00424A)
--instui-color-background-interactive-action-ai-secondary-hover-top-gradient<color>LightDarklight-dark(#F3E5F7, #522965)
--instui-color-background-interactive-action-ai-top-gradient-active<color>#793F93
--instui-color-background-interactive-action-ai-top-gradient-base<color>#944FB3
--instui-color-background-interactive-action-ai-top-gradient-hover<color>#9E58BD
--instui-color-background-interactive-action-destructive-active<color>#AE161B
--instui-color-background-interactive-action-destructive-base<color>#CF1F24
--instui-color-background-interactive-action-destructive-hover<color>#E62429
--instui-color-background-interactive-action-primary-active<color>LightDarklight-dark(#061C30, #D5E2F6)
--instui-color-background-interactive-action-primary-base<color>LightDarklight-dark(#1D354F, #EEF4FD)
--instui-color-background-interactive-action-primary-hover<color>LightDarklight-dark(#234465, #ffffff)
--instui-color-background-interactive-action-secondary-active<color>light-dark(color-mix(in srgb, #44709F 15%, transparent), #2E5177)
--instui-color-background-interactive-action-success-base<color>#037D37
--instui-color-background-interactive-action-success-hover<color>#03893D
--instui-color-background-muted<color>LightDarklight-dark(#F2F4F5, #273540)
--instui-color-stroke-interactive-action-ai-bottom-gradient-active<color>LightDarklight-dark(#01626E, #02717E)
--instui-color-stroke-interactive-action-ai-bottom-gradient-base<color>#027887
--instui-color-stroke-interactive-action-ai-bottom-gradient-hover<color>#00828E
--instui-color-stroke-interactive-action-ai-top-gradient-active<color>LightDarklight-dark(#793F93, #8A49A7)
--instui-color-stroke-interactive-action-ai-top-gradient-base<color>#944FB3
--instui-color-stroke-interactive-action-ai-top-gradient-hover<color>#9E58BD
--instui-color-stroke-interactive-action-primary-active<color>LightDarklight-dark(#061C30, #D5E2F6)
--instui-color-stroke-interactive-action-primary-base<color>LightDarklight-dark(#1D354F, #EEF4FD)
--instui-color-stroke-interactive-action-primary-hover<color>LightDarklight-dark(#234465, #ffffff)
--instui-color-stroke-interactive-action-secondary-active<color>light-dark(color-mix(in srgb, #44709F 0%, transparent), #2E5177)
--instui-color-text-interactive-action-ai-active<color>#ffffff
--instui-color-text-interactive-action-ai-base<color>#ffffff
--instui-color-text-interactive-action-ai-hover<color>#ffffff
--instui-color-text-interactive-action-ai-secondary-bottom-gradient-base<color>LightDarklight-dark(#027887, #3CC0D4)
--instui-color-text-interactive-action-ai-secondary-top-gradient-base<color>LightDarklight-dark(#944FB3, #CAA1D9)
--instui-color-text-interactive-action-primary-base<color>LightDarklight-dark(#ffffff, #1D354F)
--instui-color-text-interactive-action-secondary-base<color>LightDarklight-dark(#1D354F, #ffffff)
--instui-color-text-interactive-action-status-base<color>#ffffff
--instui-component-base-button-ai-disabled-background-color<color>LightDarklight-dark(#DFE1E3, #334450)
--instui-component-base-button-ai-disabled-border-color<color>LightDarklight-dark(#DFE1E3, #334450)
--instui-component-base-button-ai-disabled-text-color<color>LightDarklight-dark(#9EA6AD, #6A7883)
--instui-component-base-button-border-radius<length>0.75rem
--instui-component-base-button-large-font-size<length>1.125rem
--instui-component-base-button-large-height<length>3rem
--instui-component-base-button-large-padding-horizontal<length>1.25rem
--instui-component-base-button-medium-font-size<length>1rem
--instui-component-base-button-medium-height<length>2.5rem
--instui-component-base-button-medium-padding-horizontal<length>1rem
--instui-component-base-button-primary-color<color>LightDarklight-dark(#ffffff, #1D354F)
--instui-component-base-button-primary-disabled-background-color<color>LightDarklight-dark(#C7CACD, #4A5B68)
--instui-component-base-button-primary-disabled-border-color<color>LightDarklight-dark(#C7CACD, #4A5B68)
--instui-component-base-button-primary-ghost-active-background<color>color-mix(in srgb, light-dark(#1D354F, #EEF4FD) 20%, transparent)
--instui-component-base-button-primary-ghost-background<color>transparent
--instui-component-base-button-primary-ghost-border-color<color>color-mix(in srgb, light-dark(#1D354F, #EEF4FD) 40%, transparent)
--instui-component-base-button-primary-ghost-color<color>LightDarklight-dark(#1D354F, #EEF4FD)
--instui-component-base-button-primary-ghost-hover-background<color>color-mix(in srgb, light-dark(#1D354F, #EEF4FD) 10%, transparent)
--instui-component-base-button-primary-inverse-active-background<color>#E2EAF7
--instui-component-base-button-primary-inverse-background<color>#ffffff
--instui-component-base-button-primary-inverse-border-color<color>#ffffff
--instui-component-base-button-primary-inverse-color<color>#213D5B
--instui-component-base-button-primary-inverse-hover-background<color>#EEF4FD
--instui-component-base-button-primary-on-color-active-border-color<color>#B6CCEA
--instui-component-base-button-primary-on-color-active-text-color<color>#213D5B
--instui-component-base-button-primary-on-color-disabled-background-color<color>#8D959F
--instui-component-base-button-primary-on-color-disabled-border-color<color>#8D959F
--instui-component-base-button-primary-on-color-disabled-text-color<color>#4A5B68
--instui-component-base-button-primary-on-color-hover-border-color<color>#D5E2F6
--instui-component-base-button-primary-on-color-hover-text-color<color>#213D5B
--instui-component-base-button-secondary-active-background<color>hsl(from light-dark(#44709f33, #86a8d54d) h s calc(l * 0.85))
--instui-component-base-button-secondary-active-border-color<color>color-mix(in srgb, light-dark(#44709f33, #86a8d54d) 0%, transparent)
--instui-component-base-button-secondary-active-text-color<color>LightDarklight-dark(#1D354F, #ffffff)
--instui-component-base-button-secondary-background<color>LightDarklight-dark(#44709f33, #86a8d54d)
--instui-component-base-button-secondary-border-color<color>color-mix(in srgb, light-dark(#44709f33, #86a8d54d) 0%, transparent)
--instui-component-base-button-secondary-color<color>LightDarklight-dark(#1D354F, #ffffff)
--instui-component-base-button-secondary-disabled-background-color<color>LightDarklight-dark(#DFE1E3, #334450)
--instui-component-base-button-secondary-disabled-border-color<color>LightDarklight-dark(#DFE1E3, #334450)
--instui-component-base-button-secondary-disabled-text-color<color>LightDarklight-dark(#9EA6AD, #6A7883)
--instui-component-base-button-secondary-hover-background<color>hsl(from light-dark(#44709f33, #86a8d54d) h s calc(l + (100 - l) * 0.4))
--instui-component-base-button-secondary-hover-border-color<color>color-mix(in srgb, light-dark(#44709f33, #86a8d54d) 0%, transparent)
--instui-component-base-button-secondary-hover-text-color<color>LightDarklight-dark(#1D354F, #ffffff)
--instui-component-base-button-small-font-size<length>0.875rem
--instui-component-base-button-small-height<length>2rem
--instui-component-base-button-small-padding-horizontal<length>0.75rem
--instui-component-base-button-tertiary-active-border-color<color>color-mix(in srgb, light-dark(#1D354F, #EEF4FD) 30%, transparent)
--instui-component-base-button-tertiary-active-text-color<color>LightDarklight-dark(#1D354F, #EEF4FD)
--instui-component-base-button-tertiary-disabled-border-color<color>LightDarklight-dark(#C7CACD, #4A5B68)
--instui-component-base-button-tertiary-disabled-text-color<color>LightDarklight-dark(#AAB0B5, #4A5B68)
--instui-component-base-button-tertiary-hover-border-color<color>color-mix(in srgb, light-dark(#1D354F, #EEF4FD) 20%, transparent)
--instui-component-base-button-tertiary-hover-text-color<color>LightDarklight-dark(#1D354F, #EEF4FD)
--instui-component-icon-action-ai-disabled-color<color>LightDarklight-dark(#9EA6AD, #6A7883)
--instui-spacing-space-xs<length>0.25rem

Underkomponenter ​

Relateret ​