pub struct TooltipProps {
pub target: NodeRef,
pub id: Option<AttrValue>,
pub children: Children,
pub placement: Placement,
pub fade: bool,
pub show: bool,
pub trigger_on_focus: TooltipFocusTrigger,
pub trigger_on_hover: bool,
pub disabled: bool,
}Fields§
§target: NodeRefThe node which this tooltip is attached to.
If the target can be disabled, pass the same value to
Tooltip’s disabled property to ensure that the
tooltip will be automatically hidden, even if it had focus, was being
hovered or clicked.
id: Option<AttrValue>ID of the tooltip.
If this is set, Tooltip will set the target’s aria-describedby
attribute whenever it is visible.
children: ChildrenContent of the tooltip.
placement: PlacementPlacement of the tooltip.
fade: boolUse fade transition when showing or hiding the tooltip.
show: boolIf true, always show the tooltip, regardless of focus state.
disabled = true overrides this option.
trigger_on_focus: TooltipFocusTriggerShow the tooltip when the target node recieves input
or keyboard focus.
This defaults to TooltipFocusTrigger::Always, which always shows the
tooltip on input focus. See TooltipFocusTrigger for other options
which selectively disable this behaviour based on media queries,
and full caveats on each.
This will not trigger on disabled elements.
§Safari/WebKit focus events
Unlike most other web browsers (even on macOS), Safari and other
browsers using the WebKit renderer1 do not fire focus events for
components which do not accept keyboard input (such as <a> and
<button> elements) when clicked or touched,
following macOS conventions.
In Safari on macOS, pressing Option + Tab will
allow you to focus components that does not accept keyboard input, and
will fire a focus event similarly to other platforms. If
keyboard navigation is enabled in System Settings, pressing
Tab cycles focus between any component (like other
platforms).
Safari will fire focus and (potentially-synthetic) hover events
for components which accept keyboard input (such as
<input type="text">) when clicked or touched. Touchscreen devices on
most other platforms will only fire focus events on touch, not
hover.
Outside of the European Union, all browsers on iOS also use WebKit. ↩
trigger_on_hover: boolShow the tooltip when the target component has the
mouse cursor hovered over it.
This defaults to true, but will not trigger on disabled elements.
Note: touchscreen devices and keyboard-only users may not trigger
hover events. Ensure there is some other way to trigger the tooltip on
those devices, such as with
trigger_on_focus={TooltipFocusTrigger::Always}.
Safari on iOS reports synthetic mouseenter events on touchscreen
devices, when browsers on other platforms with touchscreens
traditionally do not.
However, Safari on iOS does not fire focus events for components
which do not accept keyboard input (such as <a> and <button>), so
synthetic hover events are the only way to trigger tooltips.
disabled: boolIf true, always hide the tooltip. This overrides all other
conditions.
The tooltip will remain part of the DOM.
Disabled elements don’t fire events, including focusout on a
currently-focused element and mouseleave of a currently-hovered
element. This could cause a tooltip to be “stuck” being shown.
This property allows you to automatically hide a Tooltip which has
trigger_on_focus = true or
trigger_on_hover = true whenever the
target is disabled.
Warning: entirely removing the Tooltip from the DOM whenever the
target is disabled can cause strange behaviour if the
that tooltip is currently being displayed.
Trait Implementations§
Source§impl Clone for TooltipProps
impl Clone for TooltipProps
Source§fn clone(&self) -> TooltipProps
fn clone(&self) -> TooltipProps
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl PartialEq for TooltipProps
impl PartialEq for TooltipProps
Source§impl Properties for TooltipProps
impl Properties for TooltipProps
impl StructuralPartialEq for TooltipProps
Auto Trait Implementations§
impl Freeze for TooltipProps
impl !RefUnwindSafe for TooltipProps
impl !Send for TooltipProps
impl !Sync for TooltipProps
impl Unpin for TooltipProps
impl !UnwindSafe for TooltipProps
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
Source§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
self to a value of a Properties struct.Source§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
Source§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
self to a value of a Properties struct.