16 releases

new 0.2.1 Apr 25, 2025
0.1.16 Apr 17, 2025
0.1.13 Mar 12, 2025
0.1.10 Dec 16, 2024
0.1.7 Nov 21, 2024

#512 in Data structures

Download history 116/week @ 2025-01-15 147/week @ 2025-02-05 9/week @ 2025-02-12 15/week @ 2025-02-19 6/week @ 2025-02-26 139/week @ 2025-03-12 3/week @ 2025-03-19 4/week @ 2025-03-26 139/week @ 2025-04-02 13/week @ 2025-04-09 435/week @ 2025-04-16

592 downloads per month

MIT license

110KB
2.5K SLoC

Freyr UI web Components Library for Dioxus.

Why the name Freyr?

Freyr is the norse god of fertility and prosperity and is known for his beauty. Your Dioxus app should also look good, even beautiful.

Documentation:

If you wanna see a showcase of the UI components, please go to that website: freyr showcase.

Find the GitHub repo here: freyr doc repo.

Please note that the showcase website is still under development and may improve over time.

First:

cargo add freyr

This crate provides a set of customizable UI components for use in Dioxus projects. It allows developers to easily integrate and style components such as navbars and buttons, with flexible configuration options for color schemes, layouts, and responsiveness.

Warning:

This component is in the early stage of development. Components may change. Be aware of that. Also keep in mind that this crate is not meant to be THE alternative to existing professional UI component libraries for Dioxus. I just made it for fun, and shared it in the hope it also could help other developers

Features

  • Buttons
  • Tabs
  • Navbar
  • Carousel
  • Accordion
  • Dropdown
  • Dialog
  • Spinner

All those components have more features than you think. For more information about them please chack them here.

Example of the use of the navbar with a dropdown menu that uses dioxus-i18n (using the version 0.6.3 of Dioxus):

use dioxus::prelude::*;
use freyr::prelude::*;

#[component]
pub fn Navigation() -> Element {
   let mut i18n = i18n();

   let change_to_english = move |_| i18n.set_language(langid!("en-US"));
   let change_to_french = move |_| i18n.set_language(langid!("fr-FR"));

   let dropdown_items = vec!["English".to_string(), "Français".to_string()];

   let onclick_handlers: Vec<EventHandler<MouseEvent>> = vec![
       EventHandler::new(change_to_english),
       EventHandler::new(change_to_french),
   ];

   let config_dropdown = DropdownButtonConfig {
       title: t!("languages"),
       labels: dropdown_items,
       onclick: onclick_handlers,
       background_color: DropdownColorScheme::Dark,
       title_color: DropdownTitleColor::Light,
       labels_color: DropdownLabelsColor::Light,
       hover_color: DropdownHoverColor::Custom("#03346E"),
   };

   let navbar_config = NavbarConfig {
       background_color: ColorScheme::Freyr,
       nav_header: Some(String::from("Freyr")),
       orientation: Some(Orientation::Center),
       header_color: HeaderColor::Light,
       nav_items: vec![
           "Home".to_string(),
           t!("about"),
           "Contact".to_string(),
       ],
       nav_links: vec![
           "/".to_string(),
           "/about".to_string(),
           "/contact".to_string(),
       ],
       nav_item_color: NavItemsColor::Light,
       icon_color: IconColor::White,
   };


   rsx! {
       NavbarDropdownButtons { navbar_config, config_dropdown }
       Outlet::<Route> {}
   }
}

For more information and documentation about freyr, please go to docs.rs. There you may have a look at the different options that each component may provide you.

Dependencies

~17–26MB
~392K SLoC