Introduction
You can effortlessly enhance the aesthetics of the components by applying your own classes to the HTML elements either through attributes or by utilizing JavaScript during initialization.
Detailed information regarding which classes can be customized and how to
achieve this for specific components can be found in the documentation of
each component, under the Classes
section within the API tab.
This section provides comprehensive guidance on customizing components using classes.
Customizable classes in Input
The table with all classes included in Input component is available in the API tab.
Looking at the example below, we only changed the frame color. But this rule applies to each of the implemented classes. Let's take a look:
-
data-twe-class-notch-leading-normal
(ornotchLeadingNormal
as an option),data-twe-class-notch-middle-normal
(ornotchMiddleNormal
as an option) anddata-twe-class-notch-trailing-normal
(ornotchTrailingNormal
as an option) - these are the names of the attributes that we want to change. -
border-neutral-300
- this is the class that we want to replace withborder-red-500
. -
dark:border-neutral-600
- this is the class that we also want replace withborder-red-500
. It is for dark mode.
Customization via data attributes
If you want add anything new (like new color, size or something else) or
edit class which is already inside, copy all of them and then add an
attribute started with data-twe-class-
- after that goes
name
from the table. For example:
data-twe-class-notch-leading-normal
.
Important: Every data attribute has to be written in
kebab-case method!
Customization via JavaScript
In case you initialize your component using JS, you need to approach the topic a bit differently: adding classes as an argument.