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
). - The scroll state being passed into the
on_load_more
callback ofuse_infinite_scroll
. - Options for
UseWebNotificationReturn::show
. This can be used to override options passed touse_web_notification
. See MDN Docs for more info. - Options for
sync_signal_with_options
. - Return type of
use_breakpoints
- Return type of
use_broadcast_channel
. - Return type of
use_color_mode
- Options for
use_cookie_with_options
. - Options for
use_css_var_with_options
. - Options for
use_cycle_list_with_options
. - Return type of
use_cycle_list
. - Return type of
use_device_orientation
. - Options for
use_display_media
. - Return type of
use_display_media
- Return type of
use_document
. - Argument for the
on_...
handler functions ofUseDraggableOptions
. - Options for
use_draggable_with_options
. - Return type of
use_draggable
. - Event passed as argument to the event handler functions of
UseDropZoneOptions
. - Options for
use_drop_zone_with_options
. - Return type of
use_drop_zone
. - Options for
use_element_bounding_with_options
. - Return type of
use_element_bounding
. - 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_event_listener_with_options
. - Options for
use_event_source_with_options
. - Return type of
use_event_source
. - Options for
use_favicon_with_options
. - Options for
use_geolocation_with_options
. - Return type of
use_geolocation
. - Options for
use_idle_with_options
. - Return type of
use_idle
. - Options for
use_infinite_scroll_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_intl_number_format
. - Return type of
use_intl_number_format
. - Options for
use_mouse_in_element_with_options
. - Return type of
use_mouse_in_element
. - Options for
use_mouse_with_options
. - Return type of
use_mouse
. - Options for
use_mutation_observer_with_options
. - The return value of
use_mutation_observer
. - Type of the argument for the callback of
use_raf_fn
. - Options for
use_raf_fn_with_options
. - 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
use_service_worker_with_options
. - Return type of
use_service_worker
. - Return type of
use_timeout_fn
. - Options for
use_timestamp_with_controls_and_options
. - Return type of
use_timestamp_with_controls
. - Options for
use_web_notification_with_options
. See MDN Docs for more info. - Return type for
use_web_notification
. - Options for
use_websocket_with_options
. - Return type of
use_websocket
. - Return type of
use_window
. - 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
- How to display the currency in currency formatting.
- The formatting that should be displayed for the number.
- The permission to send notifications
- Return type of
use_permission
. - Return value for
use_preferred_contrast
- The scroll behavior. Can be
Auto
(= not smooth) orSmooth
. Defaults toAuto
. - When to display the sign for the number.
- Direction of syncing.
- Interval type for
UseTimestampOptions
. - 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
- Reactive
Result::is_err()
. - Reactive
Option::is_none()
. - Reactive
Result::is_ok()
. - Reactive
Option::is_some()
. - 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. - Debounce changing of a
Signal
value. - Throttle changing of a
Signal
value. - Two-way Signals synchronization.
- Reactive
document.activeElement
- Reactive viewport breakpoints.
- Reactive BroadcastChannel API.
- Reactive color mode (dark / light / customs) with auto data persistence.
- SSR-friendly and reactive cookie access.
- Version of
use_cookie
that takesUseCookieOptions
. - 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. - Reactive DeviceOrientationEvent. Provide web developers with information from the physical orientation of the device running the web page.
- Reactive
window.devicePixelRatio
- Reactive
mediaDevices.getDisplayMedia
streaming. - Version of
use_display_media
that accepts aUseDisplayMediaOptions
. - SSR safe
document()
. This returns just a new-type wrapper aroundOption<Document>
. Calling this amounts toNone
on the server andSome(Document)
on the client. - Reactively track
document.visibilityState
- Make elements draggable.
- Create a zone where files can be dropped.
- Reactive bounding box of an HTML element
- Version of
use_element_bounding
that takes aUseElementBoundingOptions
. Seeuse_element_bounding
for how to use. - 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.
- Version of
use_element_visibility
with that takes aUseElementVisibilityOptions
. Seeuse_element_visibility
for how to use. - 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 EventSource
- Version of
use_event_source
that takes aUseEventSourceOptions
. Seeuse_event_source
for how to use. - Reactive favicon.
- Reactive Geolocation API. It allows the user to provide their location to web applications if they so desire. For privacy reasons, the user is asked for permission to report location information.
- Demo
- Infinite scrolling of the element.
- Version of
use_infinite_scroll
that takes aUseInfiniteScrollOptions
. Seeuse_infinite_scroll
for how to use. - 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
Intl.NumberFormat
. - Reactive Media Query.
- Reactive mouse position
- Reactive mouse position related to an element.
- Version of
use_mouse_in_element
that takes aUseMouseInElementOptions
. Seeuse_mouse_in_element
for how to use. - Reactive MutationObserver.
- Version of
use_mutation_observer
that takes aUseMutationObserverOptions
. Seeuse_mutation_observer
for how to use. - Reactive Permissions API.
- Reactive prefers-contrast media query.
- Reactive dark theme preference.
- Call function on every requestAnimationFrame. With controls of pausing and resuming.
- 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. - Reactive ServiceWorker API.
- Version of
use_service_worker
that takes aUseServiceWorkerOptions
. Seeuse_service_worker
for how to use. - Reactive sort of iterable
- Version of
use_sorted
with a compare function. - Version of
use_sorted
by key. - 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. - Wrapper for
setTimeout
with controls. - Reactive current timestamp.
- Version of
use_timestamp
that returns controls. Seeuse_timestamp
for how to use. - Version of
use_timestamp
that takes aUseTimestampOptions
and returns controls. Seeuse_timestamp
for how to use. - Reactive
ToString::to_string()
. - Reactive Notification API.
- Version of
use_web_notification
which takes anUseWebNotificationOptions
. - Creating and managing a Websocket connection.
- SSR safe
window()
. This returns just a new-type wrapper aroundOption<Window>
. Calling this amounts toNone
on the server andSome(Window)
on the client. - Reactively track window focus with
window.onfocus
andwindow.onblur
events. - Reactive window scroll.
- watchDeprecated
- A debounced version of
watch
. - Pausable
watch
. - A throttled version of [
watch
]. - A version of
leptos::watch
but with additional options. - Shorthand for watching a signal to be
true
.