Skip to main content

CSS variables

You can use CSS variables to customize the appearance of hanko-auth and hanko-profile elements to match your design requirements. The complete list of available CSS variables and their default values is shown below:

CSS Shadow Parts

In addition to CSS variables, you can use the ::part selector to customize specific elements within the components. Note that shadow parts only work when the web components are attached to the shadow DOM, which is the default behavior. You can enable the shadow DOM for the components using the following code:

Examples

The following examples show how to apply custom styles to specific shadow parts:

Stacking hanko-auth component fields vertically

This example demonstrates how to force the input fields and buttons within the hanko-auth component to stack vertically. The ::part(form-item) selector targets the form-item shadow part within the hanko-auth component, which is applied using the tag name.

Modifying the main headlines for Hanko components

This example shows how to adjust the main headlines for all hanko components by targeting the headline1 shadow part. The .hankoComponent::part(headline1) selector applies the styles to the headline1 shadow part within elements that have the hankoComponent class.

Applying box shadow on button of hanko-auth component

In this example, a box shadow is applied to the button shadow part of the hanko-auth component when hovering over it. The #hankoAuth::part(button):hover selector targets the button shadow part within the hanko-auth component using the ID selector #hankoAuth and applies the styles when the :hover pseudo-class is active.
For more examples and design inspiration, check out our blog post, Make Hanko Components Shine.