Back to Gradio

CSS Variables Reference

guides/11_other-tutorials/css-variables-reference.md

3.41.030.3 KB
Original Source

CSS Variables Reference

Tags: THEMES

This page lists all available CSS variables that can be set via the .set() method on a Gradio theme, organized by category. The CSS Variable column shows the variable name as used in CSS (e.g. in custom stylesheets), while the Default column shows the value set by the Base theme.

For more information on how to use these variables, see the Theming Guide.

<!-- CSS_VARS_TABLE_START -->

Body Attributes

CSS VariableDescriptionDefault
--body-background-fillThe background of the entire app.*background_fill_primary
--body-background-fill-darkThe background of the entire app in dark mode.*background_fill_primary
--body-text-colorThe default text color.*neutral_800
--body-text-color-darkThe default text color in dark mode.*neutral_100
--body-text-sizeThe default text size.*text_md
--body-text-color-subduedThe text color used for softer, less important text.*neutral_400
--body-text-color-subdued-darkThe text color used for softer, less important text in dark mode.*neutral_400
--body-text-weightThe default text weight.400
--embed-radiusThe corner radius used for embedding when the app is embedded within a page.*radius_sm

Element Colors

CSS VariableDescriptionDefault
--background-fill-primaryThe background primarily used for items placed directly on the page.white
--background-fill-primary-darkThe background primarily used for items placed directly on the page in dark mode.*neutral_950
--background-fill-secondaryThe background primarily used for items placed on top of another item.*neutral_50
--background-fill-secondary-darkThe background primarily used for items placed on top of another item in dark mode.*neutral_900
--border-color-accentThe border color used for accented items.*primary_300
--border-color-accent-darkThe border color used for accented items in dark mode.*neutral_600
--border-color-accent-subduedThe subdued border color for accented items.*border_color_accent
--border-color-accent-subdued-darkThe subdued border color for accented items in dark mode.*border_color_accent
--border-color-primaryThe border color primarily used for items placed directly on the page.*neutral_200
--border-color-primary-darkThe border color primarily used for items placed directly on the page in dark mode.*neutral_700
--color-accentThe color used for accented items.*primary_500
--color-accent-softThe softer color used for accented items.*primary_50
--color-accent-soft-darkThe softer color used for accented items in dark mode.*neutral_700
--link-text-colorThe text color used for links.*secondary_600
--link-text-color-darkThe text color used for links in dark mode.*secondary_500
--link-text-color-activeThe text color used for links when they are active.*secondary_600
--link-text-color-active-darkThe text color used for links when they are active in dark mode.*secondary_500
--link-text-color-hoverThe text color used for links when they are hovered over.*secondary_700
--link-text-color-hover-darkThe text color used for links when they are hovered over in dark mode.*secondary_400
--link-text-color-visitedThe text color used for links when they have been visited.*secondary_500
--link-text-color-visited-darkThe text color used for links when they have been visited in dark mode.*secondary_600
--prose-text-sizeThe text size used for markdown and other prose.*text_md
--prose-text-weightThe text weight used for markdown and other prose.400
--prose-header-text-weightThe text weight of a header used for markdown and other prose.600
--code-background-fillThe background color of code blocks.*neutral_100
--code-background-fill-darkThe background color of code blocks in dark mode.*neutral_800

Shadows

CSS VariableDescriptionDefault
--shadow-dropDrop shadow used by other shadowed items.rgba(0,0,0,0.05) 0px 1px 2px 0px
--shadow-drop-lgLarger drop shadow used by other shadowed items.0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)
--shadow-insetInset shadow used by other shadowed items.rgba(0,0,0,0.05) 0px 2px 4px 0px inset
--shadow-spreadSize of shadow spread used by shadowed items.3px
--shadow-spread-darkSize of shadow spread used by shadowed items in dark mode.1px

Layout Atoms

CSS VariableDescriptionDefault
--block-background-fillThe background around an item.*background_fill_primary
--block-background-fill-darkThe background around an item in dark mode.*neutral_800
--block-border-colorThe border color around an item.*border_color_primary
--block-border-color-darkThe border color around an item in dark mode.*border_color_primary
--block-border-widthThe border width around an item.1px
--block-border-width-darkThe border width around an item in dark mode.
--block-info-text-colorThe color of the info text.*body_text_color_subdued
--block-info-text-color-darkThe color of the info text in dark mode.*body_text_color_subdued
--block-info-text-sizeThe size of the info text.*text_sm
--block-info-text-weightThe weight of the info text.400
--block-label-background-fillThe background of the title label of a media element (e.g. image).*background_fill_primary
--block-label-background-fill-darkThe background of the title label of a media element (e.g. image) in dark mode.*background_fill_secondary
--block-label-border-colorThe border color of the title label of a media element (e.g. image).*border_color_primary
--block-label-border-color-darkThe border color of the title label of a media element (e.g. image) in dark mode.*border_color_primary
--block-label-border-widthThe border width of the title label of a media element (e.g. image).1px
--block-label-border-width-darkThe border width of the title label of a media element (e.g. image) in dark mode.
--block-label-shadowThe shadow of the title label of a media element (e.g. image).*block_shadow
--block-label-text-colorThe text color of the title label of a media element (e.g. image).*neutral_500
--block-label-text-color-darkThe text color of the title label of a media element (e.g. image) in dark mode.*neutral_200
--block-label-marginThe margin of the title label of a media element (e.g. image) from its surrounding container.0
--block-label-paddingThe padding of the title label of a media element (e.g. image).*spacing_sm *spacing_lg
--block-label-radiusThe corner radius of the title label of a media element (e.g. image).calc(*radius_sm - 1px) 0 calc(*radius_sm - 1px) 0
--block-label-right-radiusThe corner radius of a right-aligned helper label.0 calc(*radius_sm - 1px) 0 calc(*radius_sm - 1px)
--block-label-text-sizeThe text size of the title label of a media element (e.g. image).*text_sm
--block-label-text-weightThe text weight of the title label of a media element (e.g. image).400
--block-paddingThe padding around an item.*spacing_xl calc(*spacing_xl + 2px)
--block-radiusThe corner radius around an item.*radius_sm
--block-shadowThe shadow under an item.none
--block-shadow-darkThe shadow under an item in dark mode.
--block-title-background-fillThe background of the title of a form element (e.g. textbox).none
--block-title-background-fill-darkThe background of the title of a form element (e.g. textbox) in dark mode.
--block-title-border-colorThe border color of the title of a form element (e.g. textbox).none
--block-title-border-color-darkThe border color of the title of a form element (e.g. textbox) in dark mode.
--block-title-border-widthThe border width of the title of a form element (e.g. textbox).0px
--block-title-border-width-darkThe border width of the title of a form element (e.g. textbox) in dark mode.
--block-title-text-colorThe text color of the title of a form element (e.g. textbox).*neutral_500
--block-title-text-color-darkThe text color of the title of a form element (e.g. textbox) in dark mode.*neutral_200
--block-title-paddingThe padding of the title of a form element (e.g. textbox).0
--block-title-radiusThe corner radius of the title of a form element (e.g. textbox).none
--block-title-text-sizeThe text size of the title of a form element (e.g. textbox).*text_md
--block-title-text-weightThe text weight of the title of a form element (e.g. textbox).400
--container-radiusThe corner radius of a layout component that holds other content.*radius_sm
--form-gap-widthThe border gap between form elements, (e.g. consecutive textboxes).0px
--layout-gapThe gap between items within a row or column.*spacing_xxl
--panel-background-fillThe background of a panel.*background_fill_secondary
--panel-background-fill-darkThe background of a panel in dark mode.*background_fill_secondary
--panel-border-colorThe border color of a panel.*border_color_primary
--panel-border-color-darkThe border color of a panel in dark mode.*border_color_primary
--panel-border-widthThe border width of a panel.0
--panel-border-width-darkThe border width of a panel in dark mode.
--section-header-text-sizeThe text size of a section header (e.g. tab name).*text_md
--section-header-text-weightThe text weight of a section header (e.g. tab name).400

Component Atoms

CSS VariableDescriptionDefault
--accordion-text-colorThe body text color in the accordion.*body_text_color
--accordion-text-color-darkThe body text color in the accordion in dark mode.*body_text_color
--table-text-colorThe body text color in the table.*body_text_color
--table-text-color-darkThe body text color in the table in dark mode.*body_text_color
--checkbox-background-colorThe background of a checkbox square or radio circle.*background_fill_primary
--chatbot-text-sizeThe text size of the chatbot text.*text_lg
--checkbox-background-color-darkThe background of a checkbox square or radio circle in dark mode.*neutral_800
--checkbox-background-color-focusThe background of a checkbox square or radio circle when focused.*checkbox_background_color
--checkbox-background-color-focus-darkThe background of a checkbox square or radio circle when focused in dark mode.*checkbox_background_color
--checkbox-background-color-hoverThe background of a checkbox square or radio circle when hovered over.*checkbox_background_color
--checkbox-background-color-hover-darkThe background of a checkbox square or radio circle when hovered over in dark mode.*checkbox_background_color
--checkbox-background-color-selectedThe background of a checkbox square or radio circle when selected.*color_accent
--checkbox-background-color-selected-darkThe background of a checkbox square or radio circle when selected in dark mode.*color_accent
--checkbox-border-colorThe border color of a checkbox square or radio circle.*neutral_300
--checkbox-border-color-darkThe border color of a checkbox square or radio circle in dark mode.*neutral_700
--checkbox-border-color-focusThe border color of a checkbox square or radio circle when focused.*color_accent
--checkbox-border-color-focus-darkThe border color of a checkbox square or radio circle when focused in dark mode.*color_accent
--checkbox-border-color-hoverThe border color of a checkbox square or radio circle when hovered over.*neutral_300
--checkbox-border-color-hover-darkThe border color of a checkbox square or radio circle when hovered over in dark mode.*neutral_600
--checkbox-border-color-selectedThe border color of a checkbox square or radio circle when selected.*color_accent
--checkbox-border-color-selected-darkThe border color of a checkbox square or radio circle when selected in dark mode.*color_accent
--checkbox-border-radiusThe corner radius of a checkbox square.*radius_sm
--checkbox-border-widthThe border width of a checkbox square or radio circle.*input_border_width
--checkbox-border-width-darkThe border width of a checkbox square or radio circle in dark mode.*input_border_width
--checkbox-checkThe checkmark visual of a checkbox square.url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e")
--radio-circleThe circle visual of a radio circle.url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e")
--checkbox-shadowThe shadow of a checkbox square or radio circle.*input_shadow
--checkbox-label-background-fillThe background of the surrounding button of a checkbox or radio element.*button_secondary_background_fill
--checkbox-label-background-fill-darkThe background of the surrounding button of a checkbox or radio element in dark mode.*button_secondary_background_fill
--checkbox-label-background-fill-hoverThe background of the surrounding button of a checkbox or radio element when hovered over.*button_secondary_background_fill_hover
--checkbox-label-background-fill-hover-darkThe background of the surrounding button of a checkbox or radio element when hovered over in dark mode.*button_secondary_background_fill_hover
--checkbox-label-background-fill-selectedThe background of the surrounding button of a checkbox or radio element when selected.*checkbox_label_background_fill
--checkbox-label-background-fill-selected-darkThe background of the surrounding button of a checkbox or radio element when selected in dark mode.*checkbox_label_background_fill
--checkbox-label-border-colorThe border color of the surrounding button of a checkbox or radio element.*border_color_primary
--checkbox-label-border-color-darkThe border color of the surrounding button of a checkbox or radio element in dark mode.*border_color_primary
--checkbox-label-border-color-hoverThe border color of the surrounding button of a checkbox or radio element when hovered over.*checkbox_label_border_color
--checkbox-label-border-color-hover-darkThe border color of the surrounding button of a checkbox or radio element when hovered over in dark mode.*checkbox_label_border_color
--checkbox-label-border-color-selectedThe border color of the surrounding button of a checkbox or radio element when selected.*checkbox_label_border_color
--checkbox-label-border-color-selected-darkThe border color of the surrounding button of a checkbox or radio element when selected in dark mode.*checkbox_label_border_color
--checkbox-label-border-widthThe border width of the surrounding button of a checkbox or radio element.*input_border_width
--checkbox-label-border-width-darkThe border width of the surrounding button of a checkbox or radio element in dark mode.*input_border_width
--checkbox-label-gapThe gap consecutive checkbox or radio elements.*spacing_lg
--checkbox-label-paddingThe padding of the surrounding button of a checkbox or radio element.*spacing_md calc(2 * *spacing_md)
--checkbox-label-shadowThe shadow of the surrounding button of a checkbox or radio element.none
--checkbox-label-text-sizeThe text size of the label accompanying a checkbox or radio element.*text_md
--checkbox-label-text-weightThe text weight of the label accompanying a checkbox or radio element.400
--checkbox-label-text-colorThe text color of the label accompanying a checkbox or radio element.*body_text_color
--checkbox-label-text-color-darkThe text color of the label accompanying a checkbox or radio element in dark mode.*body_text_color
--checkbox-label-text-color-selectedThe text color of the label accompanying a checkbox or radio element when selected.*checkbox_label_text_color
--checkbox-label-text-color-selected-darkThe text color of the label accompanying a checkbox or radio element when selected in dark mode.*checkbox_label_text_color
--error-background-fillThe background of an error message.#fef2f2
--error-background-fill-darkThe background of an error message in dark mode.*background_fill_primary
--error-border-colorThe border color of an error message.#b91c1c
--error-border-color-darkThe border color of an error message in dark mode.#ef4444
--error-border-widthThe border width of an error message.1px
--error-border-width-darkThe border width of an error message in dark mode.
--error-text-colorThe text color of an error message.#b91c1c
--error-text-color-darkThe text color of an error message in dark mode.#fef2f2
--error-icon-color#b91c1c
--error-icon-color-dark#ef4444
--input-background-fillThe background of an input field.*neutral_100
--input-background-fill-darkThe background of an input field in dark mode.*neutral_700
--input-background-fill-focusThe background of an input field when focused.*input_background_fill
--input-background-fill-focus-darkThe background of an input field when focused in dark mode.
--input-background-fill-hoverThe background of an input field when hovered over.*input_background_fill
--input-background-fill-hover-darkThe background of an input field when hovered over in dark mode.*input_background_fill
--input-border-colorThe border color of an input field.*border_color_primary
--input-border-color-darkThe border color of an input field in dark mode.*border_color_primary
--input-border-color-focusThe border color of an input field when focused.*secondary_300
--input-border-color-focus-darkThe border color of an input field when focused in dark mode.*neutral_700
--input-border-color-hoverThe border color of an input field when hovered over.*input_border_color
--input-border-color-hover-darkThe border color of an input field when hovered over in dark mode.*input_border_color
--input-border-widthThe border width of an input field.0px
--input-border-width-darkThe border width of an input field in dark mode.
--input-paddingThe padding of an input field.*spacing_xl
--input-placeholder-colorThe placeholder text color of an input field.*neutral_400
--input-placeholder-color-darkThe placeholder text color of an input field in dark mode.*neutral_500
--input-radiusThe corner radius of an input field.*radius_sm
--input-shadowThe shadow of an input field.none
--input-shadow-darkThe shadow of an input field in dark mode.
--input-shadow-focusThe shadow of an input field when focused.*input_shadow
--input-shadow-focus-darkThe shadow of an input field when focused in dark mode.
--input-text-sizeThe text size of an input field.*text_md
--input-text-weightThe text weight of an input field.400
--loader-colorThe color of the loading animation while a request is pending.*color_accent
--loader-color-darkThe color of the loading animation while a request is pending in dark mode.
--slider-colorThe color of the slider in a range element.*color_accent
--slider-color-darkThe color of the slider in a range element in dark mode.
--stat-background-fillThe background used for stats visuals (e.g. confidence bars in label).*primary_300
--stat-background-fill-darkThe background used for stats visuals (e.g. confidence bars in label) in dark mode.*primary_500
--table-border-colorThe border color of a table.*neutral_300
--table-border-color-darkThe border color of a table in dark mode.*neutral_700
--table-even-background-fillThe background of even rows in a table.white
--table-even-background-fill-darkThe background of even rows in a table in dark mode.*neutral_950
--table-odd-background-fillThe background of odd rows in a table.*neutral_50
--table-odd-background-fill-darkThe background of odd rows in a table in dark mode.*neutral_900
--table-radiusThe corner radius of a table.*radius_sm
--table-row-focusThe background of a focused row in a table.*color_accent_soft
--table-row-focus-darkThe background of a focused row in a table in dark mode.*color_accent_soft

Buttons

CSS VariableDescriptionDefault
--button-border-widthThe border width of a button.*input_border_width
--button-border-width-darkThe border width of a button in dark mode.
--button-transform-hoverThe transform animation of a button on hover.none
--button-transform-activeThe transform animation of a button when pressed.none
--button-transitionThe transition animation duration of a button between regular, hover, and focused states.all 0.2s ease
--button-large-paddingThe padding of a button with the default "large" size.*spacing_lg calc(2 * *spacing_lg)
--button-large-radiusThe corner radius of a button with the default "large" size.*radius_md
--button-large-text-sizeThe text size of a button with the default "large" size.*text_lg
--button-large-text-weightThe text weight of a button with the default "large" size.600
--button-small-paddingThe padding of a button set to "small" size.*spacing_sm calc(1.5 * *spacing_sm)
--button-small-radiusThe corner radius of a button set to "small" size.*radius_md
--button-small-text-sizeThe text size of a button set to "small" size.*text_sm
--button-small-text-weightThe text weight of a button set to "small" size.400
--button-medium-paddingThe padding of a button set to "medium" size.*spacing_md calc(2 * *spacing_md)
--button-medium-radiusThe corner radius of a button set to "medium" size.*radius_md
--button-medium-text-sizeThe text size of a button set to "medium" size.*text_md
--button-medium-text-weightThe text weight of a button set to "medium" size.600
--button-primary-background-fillThe background of a button of "primary" variant.*primary_500
--button-primary-background-fill-darkThe background of a button of "primary" variant in dark mode.*primary_600
--button-primary-background-fill-hoverThe background of a button of "primary" variant when hovered over.*primary_600
--button-primary-background-fill-hover-darkThe background of a button of "primary" variant when hovered over in dark mode.*primary_700
--button-primary-border-colorThe border color of a button of "primary" variant.*primary_500
--button-primary-border-color-darkThe border color of a button of "primary" variant in dark mode.*primary_600
--button-primary-border-color-hoverThe border color of a button of "primary" variant when hovered over.*primary_500
--button-primary-border-color-hover-darkThe border color of a button of "primary" variant when hovered over in dark mode.*primary_500
--button-primary-text-colorThe text color of a button of "primary" variant.white
--button-primary-text-color-darkThe text color of a button of "primary" variant in dark mode.white
--button-primary-text-color-hoverThe text color of a button of "primary" variant when hovered over.*button_primary_text_color
--button-primary-text-color-hover-darkThe text color of a button of "primary" variant when hovered over in dark mode.*button_primary_text_color
--button-primary-shadowThe shadow under a primary button.none
--button-primary-shadow-hoverThe shadow under a primary button when hovered over.*button_primary_shadow
--button-primary-shadow-activeThe shadow under a primary button when pressed.*button_primary_shadow
--button-primary-shadow-darkThe shadow under a primary button in dark mode.
--button-primary-shadow-hover-darkThe shadow under a primary button when hovered over in dark mode.*button_primary_shadow
--button-primary-shadow-active-darkThe shadow under a primary button when pressed in dark mode.*button_primary_shadow
--button-secondary-background-fillThe background of a button of default "secondary" variant.*neutral_200
--button-secondary-background-fill-darkThe background of a button of default "secondary" variant in dark mode.*neutral_600
--button-secondary-background-fill-hoverThe background of a button of default "secondary" variant when hovered over.*neutral_300
--button-secondary-background-fill-hover-darkThe background of a button of default "secondary" variant when hovered over in dark mode.*neutral_700
--button-secondary-border-colorThe border color of a button of default "secondary" variant.*neutral_200
--button-secondary-border-color-darkThe border color of a button of default "secondary" variant in dark mode.*neutral_600
--button-secondary-border-color-hoverThe border color of a button of default "secondary" variant when hovered over.*neutral_200
--button-secondary-border-color-hover-darkThe border color of a button of default "secondary" variant when hovered over in dark mode.*neutral_500
--button-secondary-text-colorThe text color of a button of default "secondary" variant.black
--button-secondary-text-color-darkThe text color of a button of default "secondary" variant in dark mode.white
--button-secondary-text-color-hoverThe text color of a button of default "secondary" variant when hovered over.*button_secondary_text_color
--button-secondary-text-color-hover-darkThe text color of a button of default "secondary" variant when hovered over in dark mode.*button_secondary_text_color
--button-secondary-shadowThe shadow under a secondary button.*button_primary_shadow
--button-secondary-shadow-hoverThe shadow under a secondary button when hovered over.*button_secondary_shadow
--button-secondary-shadow-activeThe shadow under a secondary button when pressed.*button_secondary_shadow
--button-secondary-shadow-darkThe shadow under a secondary button in dark mode.
--button-secondary-shadow-hover-darkThe shadow under a secondary button when hovered over in dark mode.*button_secondary_shadow
--button-secondary-shadow-active-darkThe shadow under a secondary button when pressed in dark mode.*button_secondary_shadow
--button-cancel-background-fillThe background of a button of "cancel" variant.*button_secondary_background_fill
--button-cancel-background-fill-darkThe background of a button of "cancel" variant in dark mode.*button_secondary_background_fill
--button-cancel-background-fill-hoverThe background of a button of "cancel" variant when hovered over.*button_secondary_background_fill_hover
--button-cancel-background-fill-hover-darkThe background of a button of "cancel" variant when hovered over in dark mode.*button_secondary_background_fill_hover
--button-cancel-border-colorThe border color of a button of "cancel" variant.*button_secondary_border_color
--button-cancel-border-color-darkThe border color of a button of "cancel" variant in dark mode.*button_secondary_border_color
--button-cancel-border-color-hoverThe border color of a button of "cancel" variant when hovered over.*button_secondary_border_color_hover
--button-cancel-border-color-hover-darkThe border color of a button of "cancel" variant when hovered over in dark mode.*button_secondary_border_color_hover
--button-cancel-text-colorThe text color of a button of "cancel" variant.*button_secondary_text_color
--button-cancel-text-color-darkThe text color of a button of "cancel" variant in dark mode.*button_secondary_text_color
--button-cancel-text-color-hoverThe text color of a button of "cancel" variant when hovered over.*button_secondary_text_color_hover
--button-cancel-text-color-hover-darkThe text color of a button of "cancel" variant when hovered over in dark mode.white
--button-cancel-shadowThe shadow under a button of "cancel" variant.*button_secondary_shadow
--button-cancel-shadow-hoverThe shadow under a button of "cancel" variant when hovered over.*button_secondary_shadow_hover
--button-cancel-shadow-activeThe shadow under a button of "cancel" variant when pressed.*button_secondary_shadow_active
--button-cancel-shadow-darkThe shadow under a button of "cancel" variant in dark mode.*button_secondary_shadow
--button-cancel-shadow-hover-darkThe shadow under a button of "cancel" variant when hovered over in dark mode.*button_secondary_shadow_hover
--button-cancel-shadow-active-darkThe shadow under a button of "cancel" variant when pressed in dark mode.*button_secondary_shadow_active
<!-- CSS_VARS_TABLE_END -->