Crate leptos_use
source ·Expand description
Collection of essential Leptos utilities inspired by SolidJS USE / VueUse
Re-exports
pub use crate::utils::DebounceOptions;
pub use crate::utils::ThrottleOptions;
Modules
- Collection of documentation related utilities. Used extensively in the examples.
- Collection of reactive math functions
Macros
- Defines builder methods to define filter options without having to use nested methods
Structs
- Options for
on_click_outside_with_options
. - Threshold in pixels when we consider a side to have arrived (
UseScrollReturn::arrived_state
). - Return type of
use_breakpoints
- Arguments to
UseColorModeOptions::on_changed
- Return type of
use_color_mode
- Options for
use_css_var_with_options
. - Options for
use_cycle_list_with_options
. - Return type of
use_cycle_list
. - Options for
use_element_hover_with_options
. - Options for
use_element_size_with_options
. - The return value of
use_element_size
. - Options for
use_element_visibility_with_options
. - Options for
use_favicon_with_options
. - Options for
use_intersection_observer_with_options
. - The return value of
use_intersection_observer
. - Options for
use_interval_fn_with_options
- Options for
use_interval_with_options
- Return type of
use_interval
. - Options for
use_mouse_with_options
. - Return type of
use_mouse
. - The return value of
use_mutation_observer
. - Options for
use_resize_observer_with_options
. - The return value of
use_resize_observer
. - Options for
use_scroll
. Options foruse_scroll_with_options
. - The return value of
use_scroll
. - Options for
watch_debounced_with_options
. - Options for
watch_with_options
- Return type of
watch_pausable
- Options for
watch_throttled_with_options
.
Enums
- Breakpoint keys for Ant Design
- Breakpoint keys for Bootstrap V5
- Breakpoint keys for Master CSS
- Breakpoint keys for Material UI V5
- Breakpoint keys for Quasar V2
- Breakpoint keys for Sematic UI
- Breakpoint keys for Tailwind V2
- Color modes
- Return value for
use_preferred_contrast
- The scroll behavior. Can be
Auto
(= not smooth) orSmooth
. Defaults toAuto
. - Defines how to get the coordinates from the event.
- Identifies the source of the reported coordinates
Traits
- Trait to implement if you want to specify a custom extractor
Functions
- Breakpoint definitions for Ant Design
- Breakpoint definitions for Bootstrap V5
- Breakpoint definitions for Master CSS
- Breakpoint definitions for Material UI V5
- Breakpoint definitions for Quasar V2
- Breakpoint definitions for Sematic UI
- Breakpoint definitions for Tailwind V2
- Listen for clicks outside of an element. Useful for modals or dropdowns.
- Version of
on_click_outside
that takes anOnClickOutsideOptions
. Seeon_click_outside
for more details. - Demo
- Reactive viewport breakpoints.
- Reactive color mode (dark / light / customs) with auto data persistence.
- Manipulate CSS variables.
- Cycle through a list of items.
- Debounce execution of a function.
- Version of
use_debounce_fn
with an argument for the debounced function. See the docs foruse_debounce_fn
for how to use. - Version of
use_debounce_fn_with_arg
with debounce options. - Version of
use_debounce_fn
with debounce options. See the docs foruse_debounce_fn
for how to use. - Reactively track
document.visibilityState
- Reactive element’s hover state.
- Version of
use_element_hover
that takes aUseElementHoverOptions
. Seeuse_element_hover
for how to use. - Reactive size of an HTML element.
- Version of
use_element_size
that takes aUseElementSizeOptions
. Seeuse_element_size
for how to use. - Tracks the visibility of an element within the viewport.
- Use EventListener with ease. Register using addEventListener on mounted, and removeEventListener automatically on cleanup.
- Version of
use_event_listener
that takesweb_sys::AddEventListenerOptions
. See the docs foruse_event_listener
for how to use. - Reactive favicon.
- Reactive IntersectionObserver.
- Version of
use_intersection_observer
that takes aUseIntersectionObserverOptions
. Seeuse_intersection_observer
for how to use. - Reactive counter increases on every interval.
- Wrapper for
set_interval
with controls. - Reactive Media Query.
- Reactive mouse position
- Reactive MutationObserver.
- Version of
use_mutation_observer
that takes aweb_sys::MutationObserverInit
. Seeuse_mutation_observer
for how to use. - Reactive prefers-contrast media query.
- Reactive dark theme preference.
- Reports changes to the dimensions of an Element’s content or the border-box.
- Version of
use_resize_observer
that takes aweb_sys::ResizeObserverOptions
. Seeuse_resize_observer
for how to use. - Reactive scroll position and state.
- Version of
use_scroll
with options. Seeuse_scroll
for how to use. - SSR compatibe
is_supported
- Throttle execution of a function. Especially useful for rate limiting execution of handlers on events like resize and scroll.
- Version of
use_throttle_fn
with an argument for the throttled function. See the docs foruse_throttle_fn
for how to use. - Version of
use_throttle_fn_with_arg
with throttle options. See the docs foruse_throttle_fn
for how to use. - Version of
use_throttle_fn
with throttle options. See the docs foruse_throttle_fn
for how to use. - Reactively track window focus with
window.onfocus
andwindow.onblur
events. - Reactive window scroll.
- A version of
create_effect
that listens to any dependency that is accessed insidedeps
. Also a stop handler is returned. The return value ofdeps
is passed intocallback
as an argument together with the previous value and the previous value that thecallback
itself returned the last time it ran. - A debounced version of [
watch
]. - Pausable [
watch
]. - A throttled version of [
watch
]. - Shorthand for watching a signal to be
true
.