Styles
Most components are designed to inherit the styles of the WordPress Admin interface. Only a few components carry their own custom styles. This ensures that the components will blend seamlessly with WordPress classic admin interface.
However, you can easily customize these components to match your project’s design. This guide will walk you through how to style Kubrick UI components in your WordPress project.
Base styles
To get started, you will need to include the component base styles. These styles provide the foundational styling needed for each component to render correctly and consistently.
Typically, you’ll want to load these base styles before applying any custom styles. Here’s an example:
Adding a custom class
You can further customize components by passing custom classes through the className
prop. These classes are added to the root element of the component, allowing you to easily apply your own styles.
For example:
In this example, the save-settings
class is applied to the root element of the Button
component:
You can then use this class in your CSS to customize the button’s appearance:
Using static classes
Kubrick UI components also come with built-in static classes that follow the pattern .kubrick-{component}-{selector}
. Here, {component}
represents the component name, and {selector}
refers to a specific part of the component.
These static classes allow you to apply global styles to Kubrick components. For instance, the Button
component includes a static class .kubrick-Button-root
on its root element, which you can target to style all buttons from the Kubrick library:
Some components, for example, TextField
component, for examples, contains child elements, which includes the label and and the description. You can use the static classes to style these specific parts of a component. To style the label, you can use the following CSS:
If you’ve added a custom class on the TextField
component, as follows…
…you can use the static classes with the custom class, instead of using the static root class, .kubrick-TextField-root
, to target specific elements more precisely:
You can find the complete list of static classes in the documentation for each component.