ui.icon

Icon
main.py
from nicegui import ui

ui.icon('thumb_up', color='primary').classes('text-5xl')

ui.run()
NiceGUI
Material icons and symbols
main.py
from nicegui import ui

with ui.row().classes('text-4xl'):
    ui.icon('home')
    ui.icon('o_home')
    ui.icon('r_home')
    ui.icon('sym_o_home')
    ui.icon('sym_r_home')

ui.run()
NiceGUI
Eva icons
main.py
from nicegui import ui

ui.add_head_html('<link href="https://unpkg.com/eva-icons@1.1.3/style/eva-icons.css" rel="stylesheet" />')

ui.icon('eva-github').classes('text-5xl')

ui.run()
NiceGUI
Other icon sets
main.py
from nicegui import ui

ui.add_head_html('<link href="https://cdn.jsdelivr.net/themify-icons/0.1.2/css/themify-icons.css" rel="stylesheet" />')

ui.icon('ti-car').classes('text-5xl')

ui.run()
NiceGUI
Lottie files
main.py
from nicegui import ui

ui.add_body_html('<script src="https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js"></script>')

src = 'https://assets5.lottiefiles.com/packages/lf20_MKCnqtNQvg.json'
ui.html(f'<lottie-player src="{src}" loop autoplay />').classes('w-24')

ui.run()
NiceGUI
Reference
Initializer
Properties

classes: 'Classes[Self]'

is_deleted: 'bool'

is_ignoring_events: 'bool'

name: BindableProperty

props: 'Props[Self]'

style: 'Style[Self]'

visible: BindableProperty

Methods

add_resource(path: Union[str, Path]) -> None

add_slot(name: str, template: Optional[str] = None) -> Slot

ancestors(include_self: bool = False) -> Iterator[Element]

bind_name(target_object: Any, target_name: str = 'name', forward: Callable[..., Any] = [...], backward: Callable[..., Any] = [...]) -> Self

bind_name_from(target_object: Any, target_name: str = 'name', backward: Callable[..., Any] = [...]) -> Self

bind_name_to(target_object: Any, target_name: str = 'name', forward: Callable[..., Any] = [...]) -> Self

bind_visibility(target_object: Any, target_name: str = 'visible', forward: Callable[..., Any] = [...], backward: Callable[..., Any] = [...], value: Any = None) -> Self

bind_visibility_from(target_object: Any, target_name: str = 'visible', backward: Callable[..., Any] = [...], value: Any = None) -> Self

bind_visibility_to(target_object: Any, target_name: str = 'visible', forward: Callable[..., Any] = [...]) -> Self

clear() -> None

default_classes(add: Optional[str] = None, remove: Optional[str] = None, toggle: Optional[str] = None, replace: Optional[str] = None) -> type[Self]

default_props(add: Optional[str] = None, remove: Optional[str] = None) -> type[Self]

default_style(add: Optional[str] = None, remove: Optional[str] = None, replace: Optional[str] = None) -> type[Self]

delete() -> None

descendants(include_self: bool = False) -> Iterator[Element]

get_computed_prop(prop_name: str, timeout: float = 1) -> AwaitableResponse

mark(*markers: str) -> Self

move(target_container: Optional[Element] = None, target_index: int = -1, target_slot: Optional[str] = None) -> None

on(type: str, handler: Optional[events.Handler[events.GenericEventArguments]] = None, args: Union[None, Sequence[str], Sequence[Optional[Sequence[str]]]] = None, throttle: float = 0.0, leading_events: bool = True, trailing_events: bool = True, js_handler: Optional[str] = None) -> Self

remove(element: Union[Element, int]) -> None

run_method(name: str, *args: Any, timeout: float = 1) -> AwaitableResponse

set_name(name: str) -> None

set_visibility(visible: bool) -> None

tooltip(text: str) -> Self

update() -> None

Inheritance
  • NameElement
  • TextColorElement
  • Element
  • Visibility