Struct TooltipProps

Source
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: NodeRef

The 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: Children

Content of the tooltip.

§placement: Placement§fade: bool

Use fade transition when showing or hiding the tooltip.

§show: bool

If true, always show the tooltip, regardless of focus state.

disabled = true overrides this option.

§trigger_on_focus: TooltipFocusTrigger

Show 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.


  1. Outside of the European Union, all browsers on iOS also use WebKit. 

§trigger_on_hover: bool

Show 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: bool

If 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

Source§

fn clone(&self) -> TooltipProps

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl PartialEq for TooltipProps

Source§

fn eq(&self, other: &TooltipProps) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Properties for TooltipProps

Source§

type Builder = TooltipPropsBuilder

Builder that will be used to construct properties
Source§

fn builder() -> Self::Builder

Entrypoint for building properties
Source§

impl StructuralPartialEq for TooltipProps

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoPropValue<Option<T>> for T

Source§

fn into_prop_value(self) -> Option<T>

Convert self to a value of a Properties struct.
Source§

impl<T> IntoPropValue<T> for T

Source§

fn into_prop_value(self) -> T

Convert self to a value of a Properties struct.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<Token, Builder, How> AllPropsFor<Builder, How> for Token
where Builder: Buildable<Token>, <Builder as Buildable<Token>>::WrappedToken: HasAllProps<<Builder as Buildable<Token>>::Output, How>,

Source§

impl<T> HasAllProps<(), T> for T