본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

Flowbite 커스터마이징 — 설정(Configuration)

원문 보기 위키 갱신

Flowbite를 설정(Configuration) 으로 커스터마이징하면, Tailwind CSS 설정 파일(tailwind.config.js)에서 직접 테마 색상, 컨테이너, 다크 모드 등 여러 가지를 기본값을 덮어써서 원하는 대로 바꿀 수 있어요. Flowbite 플러그인과 Tailwind의 설정 체계를 함께 활용해 프로젝트에 딱 맞는 디자인 시스템을 만들 수 있답니다.

출처: 문서

본문

먼저 Tailwind 설정 파일에서 Flowbite 플러그인을 등록해야 해요. 아래는 tailwind.config.js예요.

const flowbite = require("flowbite/plugin");

/** @type {import('tailwindcss').Config} */
module.exports = {
  content: ["./node_modules/flowbite/**/*.js"],
  theme: {
    extend: {},
  },
  plugins: [flowbite],
};

색상 설정

기본 색상 팔레트를 원하는 색상으로 덮어쓸 수 있어요. theme.extend.colors에 원하는 색상을 추가하거나 기본값을 변경해요.

const flowbite = require("flowbite/plugin");

module.exports = {
  content: ["./node_modules/flowbite/**/*.js"],
  theme: {
    extend: {
      colors: {
        primary: {
          50: "#eff6ff",
          100: "#dbeafe",
          200: "#bfdbfe",
          300: "#93c5fd",
          400: "#60a5fa",
          500: "#3b82f6",
          600: "#2563eb",
          700: "#1d4ed8",
          800: "#1e40af",
          900: "#1e3a8a",
        },
      },
    },
  },
  plugins: [flowbite],
};

컨테이너 설정

theme.container을 이용해 컨테이너의 기본 폭, 중앙 정렬, 패딩 등을 설정할 수 있어요.

const flowbite = require("flowbite/plugin");

module.exports = {
  content: ["./node_modules/flowbite/**/*.js"],
  theme: {
    container: {
      center: true,
      padding: "2rem",
    },
  },
  plugins: [flowbite],
};

다크 모드 설정

Flowbite는 기본적으로 태그 기반 다크 모드를 지원해요. Tailwind의 다크 모드 전략을 class로 바꾸면 클래스 기반으로도 동작해요.

const flowbite = require("flowbite/plugin");

module.exports = {
  content: ["./node_modules/flowbite/**/*.js"],
  darkMode: "class",
  theme: {
    extend: {},
  },
  plugins: [flowbite],
};

더 알아보기 (Learn more)