Overriding Dark/Light Theme
By default, the UI uses the system color-scheme (dark or light). This may not suit your application though, so you can force either dark or light using thecolor-scheme CSS property. For example, the styles below will force light mode.
Direct CSS Properties
Some CSS properties can be set directly on thecorti-dictation component and will affect the component’s :host element, similar to how color-scheme works. These include inherited properties that affect the host:
Using CSS Variables
For more control in customization of the UI component, you can redefine the variables inside a global CSS file or within a<style> tag. Note, the following CSS variables may change over time.
Available Styling Variables
Component Defaults
| Variable | Default Value (Light) | Description |
|---|---|---|
--component-font-family | -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, Cantarell, Ubuntu, roboto, noto, helvetica, arial, sans-serif | The font family used in the component. |
--component-text-color | #333 | Text color for the component. |
Card Styling
| Variable | Default Value (Light) | Description |
|---|---|---|
--card-background | #fff | Background color of the component’s card. |
--card-border-color | #ddd | Border color of the card. |
--card-padding | 4px | Padding inside the card. |
--card-border-radius | 8px | Outer border radius of the card. |
--card-inner-border-radius | 6px | Inner border radius of the card. |
--card-box-shadow | 0 2px 5px rgba(0, 0, 0, 0.1) | Shadow effect for the card. |
Action Buttons
| Variable | Default Value (Light) | Description |
|---|---|---|
--action-plain-background | transparent | Background color for plain action buttons. |
--action-plain-background-hover | #ddd | Background color when hovering over plain action buttons. |
--action-accent-background | #007bff | Background color for primary action buttons. |
--action-accent-background-hover | #0056b3 | Hover background color for primary action buttons. |
--action-accent-text-color | #fff | Text color for primary action buttons. |
--action-red-background | #dc3545 | Background color for recording active action buttons. |
--action-red-background-hover | #bd2130 | Hover background color for recording active action buttons. |
--action-red-text-color | #fff | Text color for recording active action buttons. |
Customizing with Shadow DOM
Important: Due to Shadow DOM encapsulation, you cannot use CSS selectors likecorti-dictation button from outside the component. Shadow DOM prevents external styles from penetrating into the component’s internal structure. The component does not expose CSS parts (part attributes), so ::part() selectors are not available.
If you need to style internal elements beyond what CSS custom properties allow, you must access the Shadow DOM directly. Element IDs and internal structure can change at any time though, so you should only consider this in very specific situations. If you need to access nested elements, you’ll need to traverse multiple shadow roots:
Using Individual Components
If you use the individual Dictation components (likedictation-recording-button, dictation-settings-menu, dictation-device-selector, dictation-language-selector) directly instead of the corti-dictation wrapper, you can still set CSS properties directly on them (similar to color-scheme), and use CSS custom properties. However, you cannot use CSS selectors like dictation-recording-button button because these components also use Shadow DOM.
See also
- Overview — installation and quickstart
- API Reference — full property tables for all components