Components Reference

The components object in a Code Mode style holds per-component overrides. Most individual CSS variables are easy to understand from their names, so instead of listing every one, this page explains the pattern they all follow and gives a categorized index so you can find the right key quickly.

For globals (colors, typography, spacing, and so on), see the Globals Reference. For specific quirks, like badges, logos, and the required-field indicator, see Advanced Styling Examples.

Note

A component's keys don't appear automatically in Code Mode. You can either add them manually following the pattern below, or make the change in the GUI first, which will generate the corresponding keys in Code Mode.

Structure

Every component follows the same three-layer shape:

  1. Base properties: flat CSS custom properties that always apply.
  2. State modifiers: keys starting with _ that apply only when that state is active, like hover, disabled, or focused.
  3. Dimensions: named object keys, like mode or size. We call these "dimensions" in this doc because each one is an independent axis of configuration, a component can be a certain mode and a certain size and a certain variant, all at once, each set separately. A dimension's sub-keys are the options you can pick along that axis; only the sub-key matching the component's current setting applies.

Any of these can nest inside each other. An option inside a dimension can contain its own state modifiers, and the other way around too. Here's button with all three layers, trimmed to the essentials:

{
  "components": {
    "button": {
      "--descope-button-border-radius": "var(--descope-radius-sm)",
      "--descope-button-cursor": "pointer",
      "_disabled": {
        "--descope-button-main": "var(--descope-colors-surface-light)"
      },
      "mode": {
        "primary": {
          "--descope-button-main": "var(--descope-colors-primary-main)",
          "_disabled": {
            "--descope-button-main": "var(--descope-colors-surface-dark)"
          }
        }
      }
    }
  }
}

Here, the base properties always apply. _disabled only applies when the button is disabled. mode is the dimension here, and primary is one of the options it holds, so mode.primary only applies when the button's mode is set to primary. Nested inside it, _disabled sets the disabled color just for that combination.

mode isn't special, it's just one dimension. button also has a size dimension, whose options are sm, md, lg, and so on, and a variant dimension, whose options are contained, outline, and link. So button.size.lg overrides the large-size button, and button.variant.outline overrides the outline-style button, the same way button.mode.primary overrides the primary-color button:

{
  "components": {
    "button": {
      "size": {
        "lg": { "--descope-button-font-size": "18px" }
      },
      "variant": {
        "outline": { "--descope-button-border-color": "var(--descope-button-main)" }
      }
    }
  }
}

State Modifiers

These _-prefixed keys recur across many components. Not every component supports every modifier.

ModifierApplies when
_fullWidthThe component is set to stretch to its container's width
_borderedA border is enabled on the component
_disabledThe component is disabled
_focusedThe component has keyboard/input focus
_hoverThe pointer is hovering the component
_activeThe component is in an active/pressed state
_checkedA checkbox, radio, or toggle is checked/on
_selectedAn item is the selected one in a list or group
_invalidThe component's value has failed validation
_readonly / _readOnlyThe component is read-only. Casing varies by component, so match what that component's block uses
_loadingThe component is in a loading state
_emptyThe component has no content or items
_hiddenThe component is hidden
_requiredThe component is marked required, exposing its required-indicator variable
_squareThe component renders as a fixed square (icon-only buttons)
_editableThe component allows inline editing (for example, an editable avatar)
_obfuscatedInput content is masked, as with password fields
_collapsibleA container can be expanded/collapsed
_fillTitleA collapsible container's title area grows to fill available space
_borderUsed only by collapsibleContainer for its border. Note this is singular, not _bordered
_shrinkToIndicatorA badge collapses to a small dot indicator instead of showing text
_hideCursorHides the text caret, used in the passcode component
_italic / _lowercase / _uppercaseText style transforms on the text component
_horizontalLays a component out horizontally instead of the default direction (used by timerButton, countrySubdivisionCityField)
_verticalLays a component out vertically instead of the default direction (used by divider)
_timerInsideRenders a timer inline inside its parent button rather than beside it
_iconFillCurrentColorAn icon inherits currentColor instead of its own fill
_hasValueA floating-label input currently has a value (used to keep the label raised)
_hideWhenEmptyHides the component completely when it has no content. Nests inside _empty rather than standing on its own (used by enrichedText)

Dimensions

These named object keys group related overrides under enumerated sub-keys, as described in Structure above.

DimensionTypical optionsUsed by
modeColor intent. Varies per component, commonly primary, secondary, error, success, warning, defaultalert, badge, button, link, loaderLinear, loaderRadial, notificationCard, text
sizexs, sm, md, lg, xl, 2xl (a component uses whichever subset applies)avatar, badge, button, calendar, inputWrapper, notificationCard, passcode, radioButton, timer, uploadFile, and others
variantA component's alternate visual forms, e.g. button: contained/outline/link; list: tiles; listItem: tile; text: h1-body2badge, button, list, listItem, text
shadowsm, md, lg, xl, 2xlbadge, collapsibleContainer, container, tooltip
textAlignleft, center, rightalert, button, link, radioGroup, recoveryCodes, text, textArea, textField, timer
borderRadiussm, md, lg, xl, 2xl, 3xlcollapsibleContainer (also used by container, but see the note below)
spacing / spaceBetweenxs-xl sizing steps for gaps and internal paddingalert, collapsibleContainer, container
gapxs-xl sizing steps for the space between list itemslist
horizontalPadding / verticalPaddingsm, md, lgcollapsibleContainer, container
itemPaddingxs-xlappsList
iconPositionleft, rightcollapsibleContainer
positionAnchor points like top-start, top-center, top-end, bottom-start, bottom-center, bottom-endattachment
directioncolumn, row (each with nested horizontalAlignment/verticalAlignment)container
horizontalAlignment / verticalAlignmentstart, center, endcontainer
labelTypefloating, staticinputWrapper, multiSelectComboBox
data-descope-providerSocial login provider keys, e.g. applebutton (for provider-specific hover/focus styling)
score0-4 password strength levelspasswordStrength
timerPositionend (default is the unset/start position)timerButton
enabledtrue/falsehcaptcha
idSpecific instance targeting, e.g. "ROOT" for a screen's root containercontainer

Available Components

KeyStyles
inputWrapperShared base tokens most text-style inputs inherit from
textFieldSingle-line text input
textAreaMulti-line text input
emailFieldEmail input
passwordPassword input (login)
newPasswordPassword input with policy preview (signup/reset)
numberFieldNumeric input
phoneFieldPhone number input with country code dropdown
phoneInputBoxFieldPhone number input, boxed variant
dateFieldDate picker input
monthDayField / monthDayFieldPickerMonth/day picker input and its calendar overlay
addressFieldAddress input
countrySubdivisionCityFieldCountry/state/city grouped input
autocompleteFieldText input with autocomplete suggestions
comboBox / multiSelectComboBoxDropdown select (single and multi)
hybridFieldField that can switch input types
mappingsField / multiLineMappings / samlGroupMappingsKey-value mapping inputs (attribute/group mappings)

Examples

These are complete, real component blocks. They aren't trimmed, so you can see how base properties, state modifiers, and dimensions actually combine in practice.

button is the richest example in a style file: base properties, five state modifiers, a provider-specific hover state, five color modes, four sizes, three text alignments, and three variants.

{
  "components": {
    "button": {
      "--descope-button-border-radius": "var(--descope-radius-sm)",
      "--descope-button-cursor": "pointer",
      "--descope-button-font-family": "var(--descope-fonts-font1-family)",
      "--descope-button-host-height": "3em",
      "--descope-button-icon-size": "1.5em",
      "_disabled": {
        "--descope-button-contrast": "var(--descope-colors-surface-main)",
        "--descope-button-main": "var(--descope-colors-surface-light)"
      },
      "_focused": {
        "--descope-button-outline-color": "var(--descope-button-light)"
      },
      "_fullWidth": {
        "--descope-button-host-width": "100%"
      },
      "_square": {
        "--descope-button-host-height": "3em",
        "--descope-button-host-width": "3em"
      },
      "data-descope-provider": {
        "apple": {
          "mode": {
            "primary": {
              "_hover": {
                "--descope-button-background-color": "var(--descope-colors-warning-highlight)"
              }
            }
          }
        }
      },
      "mode": {
        "primary": {
          "--descope-button-contrast": "var(--descope-colors-primary-contrast)",
          "--descope-button-main": "var(--descope-colors-primary-main)",
          "--descope-button-dark": "var(--descope-colors-primary-dark)"
        },
        "error": {
          "--descope-button-contrast": "var(--descope-colors-error-contrast)",
          "--descope-button-main": "var(--descope-colors-error-main)",
          "--descope-button-dark": "var(--descope-colors-error-dark)"
        }
      },
      "size": {
        "md": { "--descope-button-font-size": "16px" },
        "lg": { "--descope-button-font-size": "18px" }
      },
      "variant": {
        "contained": {
          "--descope-button-background-color": "var(--descope-button-main)",
          "--descope-button-label-text-color": "var(--descope-button-contrast)",
          "_hover": {
            "--descope-button-background-color": "var(--descope-button-dark)"
          }
        },
        "outline": {
          "--descope-button-border-color": "var(--descope-button-main)",
          "--descope-button-label-text-color": "var(--descope-button-main)"
        }
      }
    }
  }
}

Note the pattern inside mode: each mode sets generic -main/-dark/-contrast variables on the button itself. variant.contained then reads those generic variables instead of a specific color palette. This is what lets the same contained variant definition work correctly no matter which mode is active.

Was this helpful?

On this page