Use Lightning Base Component Design Variations

Many Lightning base components have several design variations. Each design variation gives a component a different look.

Base component design variations correspond to variations in Lightning Design System (SLDS). For example, lightning-button supports design variations that apply different colors for text and background to the buttons.

If a base component has design variations, it has a variant attribute. Use the variant attribute to pick the design variation.

This example creates a button with the brand design variation, which provides a blue background color on the button.

If you don’t specify variant, or if you specify an unsupported value, the component uses the default value. For lightning-button, the default variant is neutral.

If you don’t see a design variation that you like, or if a component doesn’t have a variant attribute, use Lightning Design System classes to achieve the styling you want.

For example, to apply a margin utility class to the lightning-button base component, use class="slds-m-left_medium".

You can also apply utility classes to elements nested in some base components. In this example, the body of the lightning-card base component uses the slds-p-horizontal_small padding utility class.

If you can’t find a suitable design variation or SLDS class, consider using styling hooks.

View the design variations and interactive examples for base components in the Component Reference.