Documenso

CSS Variables

Customize the appearance of embedded signing experiences with CSS variables and class targets.

Custom CSS and CSS variables are available on the Platform Plan.

CSS Variables

Use the cssVars prop on any embed component to override default colors, spacing, and more.

<EmbedDirectTemplate
  token="your-token"
  cssVars={{
    background: '#ffffff',
    foreground: '#000000',
    primary: '#0000ff',
    primaryForeground: '#ffffff',
    radius: '0.5rem',
  }}
/>

Colors

VariableDescription
backgroundBase background color
foregroundBase text color
mutedMuted/subtle background color
mutedForegroundMuted/subtle text color
popoverPopover/dropdown background color
popoverForegroundPopover/dropdown text color
cardCard background color
cardBorderCard border color
cardBorderTintCard border tint/highlight color
cardForegroundCard text color
fieldCardField card background color
fieldCardBorderField card border color
fieldCardForegroundField card text color
widgetWidget background color
widgetForegroundWidget text color
borderDefault border color
inputInput field border color
primaryPrimary action/button color
primaryForegroundPrimary action/button text color
secondarySecondary action/button color
secondaryForegroundSecondary button text color
accentAccent/highlight color
accentForegroundAccent/highlight text color
destructiveDestructive/danger action color
destructiveForegroundDestructive/danger text color
ringFocus ring color
warningWarning/alert color

Spacing

VariableDescription
radiusBorder radius size (e.g. 0.5rem)

Framework Usage

Pass cssVars to any embed component. The syntax varies by framework:

// React / Preact
<EmbedDirectTemplate token={token} cssVars={cssVars} />

// Vue
<EmbedDirectTemplate :token="token" :cssVars="cssVars" />

// Svelte
<EmbedDirectTemplate {token} cssVars={cssVars} />

// Solid
<EmbedDirectTemplate token={token} cssVars={cssVars} />

Color Formats

Colors can be specified in any valid CSS format:

  • Hex: #ff0000
  • RGB: rgb(255, 0, 0)
  • HSL: hsl(0, 100%, 50%)
  • Named: red

Custom CSS

Use the css prop to inject a CSS string for more targeted control:

<EmbedDirectTemplate
  token="your-token"
  css={`
    .documenso-embed {
      border-radius: 8px;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
  `}
/>

CSS Class Targets

Specific parts of the embed can be targeted with CSS classes for granular styling.

Component Classes

ClassDescription
.embed--RootMain container for the embedded experience
.embed--DocumentContainerContainer for the document and signing widget
.embed--DocumentViewerContainer for the document viewer
.embed--DocumentWidgetThe signing widget container
.embed--DocumentWidgetContainerOuter container for the signing widget
.embed--DocumentWidgetHeaderHeader section of the signing widget
.embed--DocumentWidgetContentMain content area of the signing widget
.embed--DocumentWidgetFormForm section within the signing widget
.embed--DocumentWidgetFooterFooter section of the signing widget
.embed--WaitingForTurnWaiting screen when it is not the user's turn
.embed--DocumentCompletedCompletion screen after signing
.field--FieldRootContainerBase container for document fields

Field Data Attributes

Fields expose data attributes for state-based styling:

AttributeValuesDescription
[data-field-type]SIGNATURE, TEXT, CHECKBOX, RADIO, etc.The type of field
[data-inserted]true, falseWhether the field has been filled
[data-validate]true, falseWhether the field is being validated

Example

/* Style signature fields */
.field--FieldRootContainer[data-field-type='SIGNATURE'] {
  background-color: rgba(0, 0, 0, 0.02);
}

/* Style filled fields */
.field--FieldRootContainer[data-inserted='true'] {
  background-color: var(--primary);
  opacity: 0.2;
}

/* Custom widget styling */
.embed--DocumentWidget {
  background-color: #ffffff;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

Additional Examples

/* Style all field containers with transitions */
.field--FieldRootContainer {
  transition: all 200ms ease;
}

/* Custom styles for the waiting screen */
.embed--WaitingForTurn {
  background-color: #f9fafb;
  padding: 2rem;
}

/* Responsive adjustments for the document container */
@media (min-width: 768px) {
  .embed--DocumentContainer {
    gap: 2rem;
  }
}

Best Practices


See Also

On this page