how to change font family in tailwind element's component

496 Views Asked by At

I have this select component, I want to set a custom font family as another input's have

<select data-te-select-init data-te-select-font="14">
    <option value="0">0</option>
    <option value="1">1</option>
    <option value="2">2</option>
  </select>3
1

There are 1 best solutions below

2
On

Consider using the classes option(s) to apply custom classes to elements of selects. This allows you to use a font family utility class to apply the font-family you wish.

For example, we can apply the mono font-family to the formOutline element by using the data-te-class-form-outline attribute like:

tailwind.config = {
  darkMode: "class"
  corePlugins: {
    preflight: false,
  },
};
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tw-elements/dist/css/tw-elements.min.css" />
<script src="https://cdn.tailwindcss.com/3.3.3"></script>

<select data-te-select-init data-te-select-font="14" data-te-class-form-outline="relative font-mono">
  <option value="0">0</option>
  <option value="1">1</option>
  <option value="2">2</option>
</select>3

<script src="https://cdn.jsdelivr.net/npm/tw-elements/dist/js/tw-elements.umd.min.js"></script>