Flowbite Svelte
repository·main·Indexed 25 days ago
https://github.com/themesberg/flowbite-svelteAn official UI component library for Svelte built on top of Tailwind CSS. It provides a wide range of pre-built, interactive components including layout and navigation, forms and inputs, data display, feedback and overlays, and typography. The library handles component interactivities using Svelte and includes support for icons and SVG illustrations.
What's inside flowbite-svelte
- Flowbite Svelte is an official UI component library for Svelte built on top of Tailwind CSS. It provides a collection of Svelte components designed to help developers build websites faster by handling all component interactivities using Svelte.
Explore Flowbite-Svelte Components
mainFlowbite-Svelte provides a wide range of pre-built Svelte components based on the Flowbite design system. Components are categorized into several groups including:
- Layout & Navigation: Navbar, Breadcrumb, Sidebar, Bottom Navigation, Pagination, Tabs, Accordion, Drawer (offcanvas), Mega Menu.
- Forms & Inputs: Input Field, File Input, Search Input, Select, Textarea, Checkbox, Radio, Toggle, Range Slider, Floating Label, Datepicker.
- Data Display: Badge, Card, List group, Table, Timeline, Progress bar, Avatar, Rating, Skeleton, Indicators, Gallery (Masonry).
- Feedback & Overlays: Alert, Dropdown, Modal, Toast, Tooltip, Popover, Spinner.
- Typography: Heading, Paragraph, Blockquote, Image, List, Link, Text, Horizontal line (HR).
- Miscellaneous: Button, Button group, Carousel, KBD (keyboard), Speed Dial, Video, Bottom Sticky Banner.
Join the Flowbite Svelte community
mainIf you need technical assistance or want to discuss the library, you can participate in the community through the following channels:
- GitHub Discussions: For technical questions and library discussions.
- Discord Server: For casual chatting with other users of the library.
Use Textarea for multi-line text input
mainTheTextareacomponent is a multi-line text field input designed for receiving longer chunks of text, such as comments, descriptions, or chat messages. It supports various states includingdisabledandclearablemodes.Accordion Accessibility Features
mainThe Accordion component includes built-in accessibility support:
- Keyboard Navigation: Use
Tabto navigate headers, andEnterorSpaceto toggle expansion. - ARIA Attributes: Automatic application of ARIA labels and states for screen readers.
- Focus Management: Built-in focus indicators for keyboard users.
- Screen Reader Support: Expansion and collapse states are announced automatically.
- Keyboard Navigation: Use
Use the Number Input component
mainTheNumber Inputcomponent allows users to enter numeric values within form fields. It is suitable for use cases such as quantity selectors, ZIP codes, phone numbers, and credit card inputs. It supports various layouts including disabled states, input validation via patterns, country code dropdowns, and increment/decrement control buttons.Setup the Select component
mainTo use the
Selectcomponent, import it fromflowbite-sveltein your Svelte component.<script lang="ts"> import { Select } from "flowbite-svelte"; </script>Best practices for using Badges
mainTo ensure a good user experience when using the
<Badge>component, follow these guidelines:- Be Concise: Keep badge text short (1-3 words or numbers).
- Use Sparingly: Avoid excessive badges to prevent visual clutter.
- Consistent Meaning: Use colors consistently throughout your application to convey the same meaning.
- Appropriate Size: Match the badge size to its context and importance.
- Consider Context: Place badges near related content for clarity.
- Readable Contrast: Ensure text has sufficient contrast against the badge background.
- Accessibility:
- Don't rely solely on color to convey meaning; include text or icons.
- For icon-only badges, add ARIA labels.
- Ensure interactive badges are keyboard accessible.
Setup the Timepicker component
mainTo use the
Timepickercomponent in your Svelte project, import it from theflowbite-sveltepackage.<script lang="ts"> import { Timepicker } from "flowbite-svelte"; </script>Setup the Footer component
mainTo use the Footer components, import them from
flowbite-sveltein your Svelte file:<script lang="ts"> import { Footer, FooterBrand, FooterCopyright, FooterIcon, FooterLink, FooterLinkGroup } from "flowbite-svelte"; </script>Create a Notification Badge
mainTo create a notification badge (a small indicator on top of another element), use theIndicatorcomponent as a sibling to your target element. Ensure the parent container has therelativeCSS class.Implement a Timepicker range selector
mainTo select a time interval (start and end time), use two timepicker inputs. If the end time is set to be earlier than the start time, the component logic will automatically swap the two times to maintain a valid range.