Skip to content

v0.4.0

Compare
Choose a tag to compare
@tulup-conner tulup-conner released this 03 Mar 08:46
· 337 commits to main since this release
6b67c6c

Breaking changes

usePreferences

usePreferences is no longer an option for <Flowbite theme={..}>. The light or dark mode preference established by a user's browser is still respected. The library also no longer persists the current theme in local storage. See #582

Customizing flowbite-react

The theme structure for almost all components has changed. Now, components that can have children will have a root section which contains the classes that apply only to the parent component. That's kind of a complicated sentence, so here's an example.

<Accordion>s can contain any number of <Accordion.Title>s and <Accordion.Content>s as children. The new accordion theme looks like:

export interface FlowbiteAccordionTheme {
  root: FlowbiteAccordionRootTheme; /* classes that apply to <Accordion> itself only */
  content: FlowbiteAccordionComponentTheme; /* <Accordion.Content> classes */
  title: FlowbiteAccordionTitleTheme; /* <Accordion.Title> classes */
}

Previously, the accordion theme was:

export interface FlowbiteAccordionTheme {
  base: string; /* class that applies to <Accordion> itself only */
  flush: string; /* another class that applies to <Accordion>s */
  content: FlowbiteAccordionComponentTheme; /* <Accordion.Content> classes */
  title: FlowbiteAccordionTitleTheme; /* <Accordion.Title> classes */
}

We've just moved the loose classes - for <Accordion>s, that's accordion.base and accordion.flush - into root to make the theme more clearly reflect the relationship between flowbite-react components.

What's Changed

  • style(Dropdown): update border radius from rounded to rounded-lg #(575) by @mortezasabihi in #578
  • feat(theme): add theme={} attribute to components that need it by @tulup-conner in #611
  • Prevent modal content from being truncated by @multiwebinc in #601
  • Let Timeline.Body have non-text content by @multiwebinc in #603
  • sytles(button): support for all colors in button by @lirbre in #598
  • feat(/lib/components/flowbite): remove usePreferences by @haron68 in #582
  • fix(/docs): remove {' '} literals from code examples by @tulup-conner in #614
  • feat(/lib/theme): add Tailwind CSS colors to <Alert>s by @lirbre in #586
  • docs(readme): refer to theme docs page in README by @tulup-conner in #615
  • feat(/lib/theme): add Tailwind CSS colors to <Badge>s by @lirbre in #617

Customizing flowbite-react

Completing our work in v0.3.7 and v0.3.8, the following components can now be customized with a theme={} attribute inline:

  • Accordion
    • Accordion.Content
    • Accordion.Title
  • Alert
  • Avatar
    • Avatar.Group
    • Avatar.GroupCounter
  • Badge
  • Breadcrumb
    • Breadcrumb.Item
  • Button
    • Button.Group
  • Card
  • Carousel
  • Checkbox
  • DarkThemeToggle
  • Dropdown
    • Dropdown.Item
  • FileInput
  • Footer
    • Footer.Brand
    • Footer.Copyright
    • Footer.Divider
    • Footer.Icon
    • Footer.Link
    • Footer.LinkGroup
    • Footer.Title
  • HelperText
  • Label
  • ListGroup
    • ListGroup.Item
  • Modal
    • Modal.Body
    • Modal.Footer
    • Modal.Header
  • Navbar
    • Navbar.Brand
    • Navbar.Collapse
    • Navbar.Link
    • Navbar.Toggle
  • Pagination
    • Pagination.Button
  • Progress
  • Radio
  • RangeSlider
  • Rating
    • Rating.Advanced
    • Rating.Star
  • Select
  • Sidebar
    • Sidebar.Collapse
    • Sidebar.CTA
    • Sidebar.Item
    • Sidebar.Logo
  • Spinner
  • Tabs.Group
  • Table
    • Table.Body
    • Table.Cell
    • Table.Head
    • Table.HeadCell
    • Table.Row
  • Textarea
  • TextInput
  • Timeline
    • Timeline.Body
    • Timeline.Content
    • Timeline.Item
    • Timeline.Point
    • Timeline.Time
    • Timeline.Title
  • Toast
    • Toast.Toggle
  • ToggleSwitch
  • Tooltip

Please note that components you do NOT see on this list can STILL be customized by simply adding a className. These components do not have any default classes or complex structure and thus don't need a theme at all.

We updated the documentation on themes to clarify the different options you have to customize flowbite-react. To learn more about that, visit https://flowbite-react.com/theme.

This behavior is still considered a work in progress, and in general, we are still experimenting with how to provide users with the best way to customize components. You can expect that this API might change at any time. We also need your feedback on how to improve it.

See #465 for more context on themes in this library.

New Contributors

Full Changelog: v0.3.8...v0.4.0