Crate leptos_use

Source
Expand description

Collection of essential Leptos utilities inspired by SolidJS USE / VueUse

Re-exports§

pub use core::ReconnectLimit;
pub use crate::utils::DebounceOptions;
pub use crate::utils::ThrottleOptions;

Modules§

core
docs
Collection of documentation related utilities. Used extensively in the examples.
math
Collection of reactive math functions
storage
utils

Macros§

filter_builder_methods
Defines builder methods to define filter options without having to use nested methods
js
js_fut
sendwrap_fn
Macro to wrap closures with send_wrapper::SendWrapper.
use_derive_signal
Macro to easily create helper functions that derive a signal using a piece of code.

Structs§

AudioTrackConstraints
DummyEncoder
HeartbeatOptions
Options for heartbeats
OnClickOutsideOptions
Options for on_click_outside_with_options.
ScrollOffset
Threshold in pixels when we consider a side to have arrived (UseScrollReturn::arrived_state).
ScrollState
The scroll state being passed into the on_load_more callback of use_infinite_scroll.
ShowOptions
Options for UseWebNotificationReturn::show.
SyncSignalOptions
Options for sync_signal_with_options.
UseBreakpointsReturn
Return type of use_breakpoints
UseBroadcastChannelReturn
Return type of use_broadcast_channel.
UseCalendarOptions
Options for use_calendar_with_options.
UseCalendarReturn
Return type of use_calendar.
UseClipboardOptions
Options for use_clipboard_with_options.
UseClipboardReturn
Return type of use_clipboard.
UseColorModeOptions
UseColorModeReturn
Return type of use_color_mode
UseCookieOptions
Options for use_cookie_with_options.
UseCssVarOptions
Options for use_css_var_with_options.
UseCycleListOptions
Options for use_cycle_list_with_options.
UseCycleListReturn
Return type of use_cycle_list.
UseDeviceOrientationReturn
Return type of use_device_orientation.
UseDisplayMediaOptions
Options for use_display_media.
UseDisplayMediaReturn
Return type of use_display_media
UseDocument
Return type of use_document.
UseDraggableCallbackArgs
Argument for the on_... handler functions of UseDraggableOptions.
UseDraggableOptions
Options for use_draggable_with_options.
UseDraggableReturn
Return type of use_draggable.
UseDropZoneEvent
Event passed as argument to the event handler functions of UseDropZoneOptions.
UseDropZoneOptions
Options for use_drop_zone_with_options.
UseDropZoneReturn
Return type of use_drop_zone.
UseElementBoundingOptions
Options for use_element_bounding_with_options.
UseElementBoundingReturn
Return type of use_element_bounding.
UseElementHoverOptions
Options for use_element_hover_with_options.
UseElementSizeOptions
Options for use_element_size_with_options.
UseElementSizeReturn
The return value of use_element_size.
UseElementVisibilityOptions
Options for use_element_visibility_with_options.
UseEventListenerOptions
Options for use_event_listener_with_options.
UseEventSourceOptions
Options for use_event_source_with_options.
UseEventSourceReturn
Return type of use_event_source.
UseFaviconOptions
Options for use_favicon_with_options.
UseGeolocationOptions
Options for use_geolocation_with_options.
UseGeolocationReturn
Return type of use_geolocation.
UseIdleOptions
Options for use_idle_with_options.
UseIdleReturn
Return type of use_idle.
UseInfiniteScrollOptions
Options for use_infinite_scroll_with_options.
UseIntersectionObserverOptions
Options for use_intersection_observer_with_options.
UseIntersectionObserverReturn
The return value of use_intersection_observer.
UseIntervalFnOptions
Options for use_interval_fn_with_options
UseIntervalOptions
Options for use_interval_with_options
UseIntervalReturn
Return type of use_interval.
UseIntlNumberFormatOptions
Options for use_intl_number_format.
UseIntlNumberFormatReturn
Return type of use_intl_number_format.
UseLocalesOptions
Options for crate::use_locales_with_options.
UseMouseInElementOptions
Options for use_mouse_in_element_with_options.
UseMouseInElementReturn
Return type of use_mouse_in_element.
UseMouseOptions
Options for use_mouse_with_options.
UseMouseReturn
Return type of use_mouse.
UseMutationObserverOptions
Options for use_mutation_observer_with_options.
UseMutationObserverReturn
The return value of use_mutation_observer.
UsePreferredDarkOptions
Options for crate::use_preferred_dark_with_options.
UsePrefersReducedMotionOptions
Options for crate::use_prefers_reduced_motion_with_options.
UseRafFnCallbackArgs
Type of the argument for the callback of use_raf_fn.
UseRafFnOptions
Options for use_raf_fn_with_options.
UseResizeObserverOptions
Options for use_resize_observer_with_options.
UseResizeObserverReturn
The return value of use_resize_observer.
UseScrollOptions
Options for use_scroll. Options for use_scroll_with_options.
UseScrollReturn
The return value of use_scroll.
UseServiceWorkerOptions
Options for use_service_worker_with_options.
UseServiceWorkerReturn
Return type of use_service_worker.
UseTextareaAutosizeOptions
Options for crate::use_textarea_autosize_with_options.
UseTextareaAutosizeReturn
Return type of crate::use_textarea_autosize.
UseTimeoutFnReturn
Return type of use_timeout_fn.
UseTimestampOptions
Options for use_timestamp_with_controls_and_options.
UseTimestampReturn
Return type of use_timestamp_with_controls.
UseToggleReturn
Return type of crate::use_toggle.
UseUserMediaOptions
Options for use_user_media_with_options.
UseUserMediaReturn
Return type of use_user_media.
UseWebLockOptions
Options for crate::use_web_lock_with_options.
UseWebNotificationOptions
Options for use_web_notification_with_options. See MDN Docs for more info.
UseWebNotificationReturn
Return type for use_web_notification.
UseWebSocketOptions
Options for use_websocket_with_options.
UseWebSocketReturn
Return type of use_websocket.
UseWindow
Return type of use_window.
UseWindowSizeOptions
Options for crate::use_window_size_with_options.
UseWindowSizeReturn
Return type of crate::use_window_size.
VecMarker
VideoTrackConstraints
WatchDebouncedOptions
Options for watch_debounced_with_options.
WatchOptions
Options for watch_with_options
WatchPausableReturn
Return type of watch_pausable
WatchThrottledOptions
Options for watch_throttled_with_options.

Enums§

AudioConstraints
BreakpointsAntDesign
Breakpoint keys for Ant Design
BreakpointsBootstrapV5
Breakpoint keys for Bootstrap V5
BreakpointsMasterCss
Breakpoint keys for Master CSS
BreakpointsMaterial
Breakpoint keys for Material UI V5
BreakpointsQuasar
Breakpoint keys for Quasar V2
BreakpointsSemantic
Breakpoint keys for Semantic UI
BreakpointsTailwind
Breakpoint keys for Tailwind V2
CalendarDate
Utility enum to represent a calendar date. Implements Deref to chrono::NaiveDate.
ColorMode
Color modes
CompactDisplay
ConstraintExactIdeal
ConstraintRange
CurrencyDisplay
How to display the currency in currency formatting.
CurrencySign
FacingMode
LocaleMatcher
LockMode
The LockMode enum.
MeasureType
Type of the measure_type option.
Notation
The formatting that should be displayed for the number.
NotificationDirection
NotificationPermission
The permission to send notifications
NumberGrouping
NumberStyle
PermissionState
Return type of use_permission.
PreferredContrast
Return value for use_preferred_contrast
RoundingMode
RoundingPriority
SameSite
The SameSite cookie attribute.
ScrollBehavior
The scroll behavior. Can be Auto (= not smooth) or Smooth. Defaults to Auto.
ServiceWorkerRegistrationError
SignDisplay
When to display the sign for the number.
SyncDirection
Direction of syncing.
SyncTransforms
Transforms or assigns for syncing.
TimestampInterval
Interval type for UseTimestampOptions.
TrailingZeroDisplay
UnitDisplay
UseBroadcastChannelError
UseEventSourceError
UseMouseCoordType
Defines how to get the coordinates from the event.
UseMouseSourceType
Identifies the source of the reported coordinates
UseWebLockError
UseWebSocketError
VideoConstraints

Traits§

IntoDeviceIds
UseMouseEventExtractor
Trait to implement if you want to specify a custom extractor

Functions§

breakpoints_ant_design
Breakpoint definitions for Ant Design
breakpoints_bootstrap_v5
Breakpoint definitions for Bootstrap V5
breakpoints_master_css
Breakpoint definitions for Master CSS
breakpoints_material
Breakpoint definitions for Material UI V5
breakpoints_quasar
Breakpoint definitions for Quasar V2
breakpoints_semantic
Breakpoint definitions for Semantic UI
breakpoints_tailwind
Breakpoint definitions for Tailwind V2
is_err
Reactive Result::is_err().
is_none
Reactive Option::is_none().
is_ok
Reactive Result::is_ok().
is_some
Reactive Option::is_some().
on_click_outside
Listen for clicks outside an element. Useful for modals or dropdowns.
on_click_outside_with_options
Version of on_click_outside that takes an OnClickOutsideOptions. See on_click_outside for more details.
signal_debounced
Debounce changing of a Signal value.
signal_debounced_local
Debounce changing of a Signal value that is not Send + Sync.
signal_debounced_local_with_options
Version of signal_debounced_local that accepts DebounceOptions . See signal_debounced_local for how to use.
signal_debounced_with_options
Version of signal_debounced that accepts DebounceOptions . See signal_debounced for how to use.
signal_throttled
Throttle changing of a Signal value.
signal_throttled_local
Throttle changing of a Signal value that is not Send + Sync.
signal_throttled_local_with_options
Version of signal_throttled_local that accepts [ThrottledOptions] . See signal_throttled_local for how to use.
signal_throttled_with_options
Version of signal_throttled that accepts ThrottleOptions . See signal_throttled for how to use.
sync_signal
Two-way Signals synchronization.
sync_signal_with_options
Version of sync_signal that takes a SyncSignalOptions. See sync_signal for how to use.
use_active_element
Reactive document.activeElement
use_breakpoints
Reactive viewport breakpoints.
use_broadcast_channel
Reactive BroadcastChannel API.
use_calendar
Create bare-bone calendar data to use in your component. See UseCalendarOptions for options and UseCalendarReturn for return values.
use_calendar_with_options
Version of use_calendar that takes a UseCalendarOptions. See use_calendar for how to use.
use_clipboard
Reactive Clipboard API.
use_clipboard_with_options
Version of use_clipboard that takes a UseClipboardOptions. See use_clipboard for how to use.
use_color_mode
Reactive color mode (dark / light / customs) with auto data persistence.
use_color_mode_with_options
Version of use_color_mode that takes a UseColorModeOptions. See use_color_mode for how to use.
use_cookie
SSR-friendly and reactive cookie access.
use_cookie_with_options
Version of use_cookie that takes UseCookieOptions.
use_css_var
Manipulate CSS variables.
use_css_var_with_options
Version of use_css_var that takes a UseCssVarOptions. See use_css_var for how to use.
use_cycle_list
Cycle through a list of items.
use_cycle_list_with_options
use_debounce_fn
Debounce execution of a function.
use_debounce_fn_with_arg
Version of use_debounce_fn with an argument for the debounced function. See the docs for use_debounce_fn for how to use.
use_debounce_fn_with_arg_and_options
Version of use_debounce_fn_with_arg with debounce options.
use_debounce_fn_with_options
Version of use_debounce_fn with debounce options. See the docs for use_debounce_fn for how to use.
use_device_orientation
Reactive DeviceOrientationEvent.
use_device_pixel_ratio
Reactive window.devicePixelRatio
use_display_media
Reactive mediaDevices.getDisplayMedia streaming.
use_display_media_with_options
Version of use_display_media that accepts a UseDisplayMediaOptions.
use_document
SSR safe document(). This returns just a new-type wrapper around Option<Document>. Calling this amounts to None on the server and Some(Document) on the client.
use_document_visibility
Reactively track document.visibilityState
use_draggable
Make elements draggable.
use_draggable_with_options
Version of use_draggable that takes a UseDraggableOptions. See use_draggable for how to use.
use_drop_zone
Create a zone where files can be dropped.
use_drop_zone_with_options
Version of use_drop_zone that takes a UseDropZoneOptions. See use_drop_zone for how to use.
use_element_bounding
Reactive bounding box of an HTML element
use_element_bounding_with_options
Version of use_element_bounding that takes a UseElementBoundingOptions. See use_element_bounding for how to use.
use_element_hover
Reactive element’s hover state.
use_element_hover_with_options
Version of use_element_hover that takes a UseElementHoverOptions. See use_element_hover for how to use.
use_element_size
Reactive size of an HTML element.
use_element_size_with_options
Version of use_element_size that takes a UseElementSizeOptions. See use_element_size for how to use.
use_element_visibility
Tracks the visibility of an element within the viewport.
use_element_visibility_with_options
Version of use_element_visibility with that takes a UseElementVisibilityOptions. See use_element_visibility for how to use.
use_event_listener
Use EventListener with ease.
use_event_listener_with_options
Version of use_event_listener that takes web_sys::AddEventListenerOptions. See the docs for use_event_listener for how to use.
use_event_source
Reactive EventSource
use_event_source_with_options
Version of use_event_source that takes a UseEventSourceOptions. See use_event_source for how to use.
use_favicon
Reactive favicon.
use_favicon_with_options
Version of use_favicon that accepts a UseFaviconOptions. See use_favicon for more details.
use_geolocation
Reactive Geolocation API.
use_geolocation_with_options
Version of use_geolocation that takes a UseGeolocationOptions. See use_geolocation for how to use.
use_idle
Tracks whether the user is being inactive.
use_idle_with_options
Version of use_idle that takes a UseIdleOptions. See use_idle for how to use.
use_infinite_scroll
Infinite scrolling of the element.
use_infinite_scroll_with_options
Version of use_infinite_scroll that takes a UseInfiniteScrollOptions. See use_infinite_scroll for how to use.
use_intersection_observer
Reactive IntersectionObserver.
use_intersection_observer_with_options
Version of use_intersection_observer that takes a UseIntersectionObserverOptions. See use_intersection_observer for how to use.
use_interval
Reactive counter increases on every interval.
use_interval_fn
Wrapper for set_interval with controls.
use_interval_fn_with_options
Version of use_interval_fn that takes UseIntervalFnOptions. See use_interval_fn for how to use.
use_interval_with_options
Version of use_interval that takes UseIntervalOptions. See use_interval for how to use.
use_intl_number_format
Reactive Intl.NumberFormat.
use_locale
Reactive locale matching.
use_locale_with_options
Version of crate::use_locale that takes a UseLocaleOptions. See crate::use_locale for how to use.
use_locales
Reactive locales.
use_locales_with_options
Version of crate::use_locales that takes a UseLocalesOptions. See crate::use_locales for how to use.
use_media_query
Reactive Media Query.
use_mouse
Reactive mouse position
use_mouse_in_element
Reactive mouse position related to an element.
use_mouse_in_element_with_options
Version of use_mouse_in_element that takes a UseMouseInElementOptions. See use_mouse_in_element for how to use.
use_mouse_with_options
Variant of use_mouse that accepts options. Please see use_mouse for how to use.
use_mutation_observer
Reactive MutationObserver.
use_mutation_observer_with_options
Version of use_mutation_observer that takes a UseMutationObserverOptions. See use_mutation_observer for how to use.
use_permission
Reactive Permissions API.
use_preferred_contrast
Reactive prefers-contrast media query.
use_preferred_dark
Reactive dark theme preference.
use_preferred_dark_with_options
Version of crate::use_preferred_dark that accepts a UsePreferredDarkOptions.
use_prefers_reduced_motion
Reactive reduced motions preference.
use_prefers_reduced_motion_with_options
Version of crate::use_prefers_reduced_motion that takes a UsePrefersReducedMotionOptions. See crate::use_prefers_reduced_motion for how to use.
use_raf_fn
Call function on every requestAnimationFrame. With controls of pausing and resuming.
use_raf_fn_with_options
Version of use_raf_fn that takes a UseRafFnOptions. See use_raf_fn for how to use.
use_resize_observer
Reports changes to the dimensions of an Element’s content or the border-box.
use_resize_observer_with_options
Version of use_resize_observer that takes a web_sys::ResizeObserverOptions. See use_resize_observer for how to use.
use_scroll
Reactive scroll position and state.
use_scroll_with_options
Version of use_scroll with options. See use_scroll for how to use.
use_service_worker
Reactive ServiceWorker API.
use_service_worker_with_options
Version of use_service_worker that takes a UseServiceWorkerOptions. See use_service_worker for how to use.
use_sorted
Reactive sort of iterable
use_sorted_by
Version of use_sorted with a compare function.
use_sorted_by_key
Version of use_sorted by key.
use_supported
SSR compatibe is_supported
use_textarea_autosize
Automatically update the height of a textarea depending on the content.
use_textarea_autosize_with_options
Version of crate::use_textarea_autosize that takes a UseTextareaAutosizeOptions. See crate::use_textarea_autosize for how to use.
use_throttle_fn
Throttle execution of a function. Especially useful for rate limiting execution of handlers on events like resize and scroll.
use_throttle_fn_with_arg
Version of use_throttle_fn with an argument for the throttled function. See the docs for use_throttle_fn for how to use.
use_throttle_fn_with_arg_and_options
Version of use_throttle_fn_with_arg with throttle options. See the docs for use_throttle_fn for how to use.
use_throttle_fn_with_options
Version of use_throttle_fn with throttle options. See the docs for use_throttle_fn for how to use.
use_timeout_fn
Wrapper for setTimeout with controls.
use_timestamp
Reactive current timestamp.
use_timestamp_with_controls
Version of use_timestamp that returns controls. See use_timestamp for how to use.
use_timestamp_with_controls_and_options
Version of use_timestamp that takes a UseTimestampOptions and returns controls. See use_timestamp for how to use.
use_timestamp_with_options
Version of use_timestamp that takes a UseTimestampOptions. See use_timestamp for how to use.
use_to_string
Reactive ToString::to_string().
use_toggle
A boolean switcher with utility functions.
use_user_media
Reactive mediaDevices.getUserMedia streaming.
use_user_media_with_options
Version of use_user_media that takes a UseUserMediaOptions. See use_user_media for how to use.
use_web_lock
Rustified Web Locks API.
use_web_lock_with_options
Version of crate::use_web_lock that takes a UseWebLockOptions. See crate::use_web_lock for how to use.
use_web_notification
Reactive Notification API.
use_web_notification_with_options
Version of use_web_notification which takes an UseWebNotificationOptions.
use_websocket
Creating and managing a Websocket connection.
use_websocket_with_options
Version of use_websocket that takes UseWebSocketOptions. See use_websocket for how to use.
use_window
SSR safe window(). This returns just a new-type wrapper around Option<Window>. Calling this amounts to None on the server and Some(Window) on the client.
use_window_focus
Reactively track window focus with window.onfocus and window.onblur events.
use_window_scroll
Reactive window scroll.
use_window_size
Reactive window size.
use_window_size_with_options
Version of crate::use_window_size that takes a UseWindowSizeOptions. See crate::use_window_size for how to use.
watch_debounced
A debounced version of watch.
watch_debounced_with_options
Version of watch_debounced that accepts WatchDebouncedOptions. See watch_debounced for how to use.
watch_pausable
Pausable watch.
watch_pausable_with_options
Version of watch_pausable that accepts WatchOptions. See watch_pausable for how to use.
watch_throttled
A throttled version of leptos::watch.
watch_throttled_with_options
Version of watch_throttled that accepts WatchThrottledOptions. See watch_throttled for how to use.
watch_with_options
A version of leptos::watch but with additional options.
whenever
Shorthand for watching a signal to be true.
whenever_with_options
Version of whenever that accepts WatchOptions. See whenever for how to use.

Type Aliases§

AssignFn
ConstraintBool
ConstraintDouble
ConstraintFacingMode
ConstraintULong
UseLocaleOptions