yew-material
Описание
Library for Yew framework with google icons
Языки
- Rust100%
Yew Google Material
Please, open new issue on github if you notice any error or mistake!
is a very simple crate to use some of google materials and
Unfortunately a lot of crates with materials, icons for yew framework are depricated and use depricated javascript code.
Here I use only Rust code to add some design features for yew.
Now only buttons, text fields and icons are available.
Buttons and text fields are not the same as one in google material web, but very similar to them.
Icons
To use icons from you need to add some html inside
There are three types of icons. Add this if you want to use Outlined style of icons:
To use Rounded style of icons:
To use Sharp style of icons:
Then choose on of the icons in the catalog of https://fonts.google.com/icons, i.e. 'search', 'star', 'menu', etc. and see example below.
Examples
Note, you that you can animate icon attributes with transition. The default value is "unset", but for animation it is recomended to set "all 0.2s" or as you wish.
Or you can add an icon with default options:
Buttons

GButtonStyle::Elevated styled button with trailing icon

GButtonStyle::Filled styled button

GButtonStyle::Outlined styled button

GButtonStyle::Text styled button
![]()
GButtonStyle::Filled styled icon button
The key size attribute of button is attribute. It bonds a lot of other sizes and has the default value 14px.
GButton has a lot of attributes (and you can make something similar to FAB button via them), but only are required.
Attention! You must set and/or use icon to make your button readable!
Examples
Also you can add icon with attribute. If so, you also need to set attribute together with stylesheet inside (see GIcon docs). If you need trailing icon use with together with attributes in GButton.
To adjust icon parameters use , , , attributes as well as with GIcon.
Attention! The way to add icon in this version is different from v.0.0.7.
Attention! If you change icon size within button you can break the design. Probably then you need to adjust width and height. Do it with caution.
TextFields

Simple text input with GInputStyle::Filled style

GInputStyle::Outlined slyled input with leading icon and trailing button icon
The key size attribute of input field is . It bonds a lot of other sizes of text field and has the default value 16px.
GTextInput has a lot of attributes, but only , onchange and are required. Label here has the same role as placeholder. If you do not need label, add it with empty double quotes.
See the describtion of this attributes here:
Examples
Also you can add leading and trailing GIcons, change style, change Event to InputEvent and do many other things via attributes in this way:
If you need to add trailing button icon inside input field, instead of use inside with attributes:
(icon name from ), (), (), (Outlined, Rounded or Sharp)
Do not use attribute for inside !
If you need leading button icon element inside GTextInput, just remove attribute from GButton, add for and remove .
Attentin! It is recomended to use attribute with , or your button will be on its own inside element.
Versions
0.0.8
- Now you can add icon button inside GTextInput.
- Design of icon inside button was rewritten.
- GTextInput margin fixed.
0.0.7
- ReadMe fixed
0.0.5
- GButton added
- GTextInput height attribute added
- Many of GTextInput attributes were renamed
- GIcon size adjustment in GTextInput fixed
0.0.4
- GTextInput added
0.0.3
- Only icons available, ReadMe fixed