Tooltip
The Tooltip
component is often used as a supplemental button to close things.
Examples
Tooltips
Tooltip top-start
This is the tooltip content from named slot.
Tooltip top
This is the tooltip content from named slot.
Tooltip top-end
This is the tooltip content from named slot.
Tooltip left-start
This is the tooltip content from named slot.
Tooltip left
This is the tooltip content from named slot.
Tooltip left-end
This is the tooltip content from named slot.
Tooltip right-start
This is the tooltip content from named slot.
Tooltip right
This is the tooltip content from named slot.
Tooltip right-end
This is the tooltip content from named slot.
Tooltip bottom-start
This is the tooltip content from named slot.
Tooltip bottom
This is the tooltip content from named slot.
Tooltip bottom-end
This is the tooltip content from named slot.
Usage
React
View source
import "agnostic-react/dist/common.min.css";
import "agnostic-react/dist/esm/index.css";
import { Tooltip } from "agnostic-react";
export const YourComponent = () => (
<div class="text-center tooltips-container">
<section class="mbs56 mbe40 flex-inline justify-between w-100">
<Tooltip placement="top-start" label="Tooltip hover text…">
<span className='demo-tooltip'>Tooltip (top-start). Hover me!</span>
</Tooltip>
<Tooltip placement="top" label="Tooltip hover text…">
<span className='demo-tooltip'>Tooltip (top). Hover me!</span>
</Tooltip>
<Tooltip placement="top-right" label="Tooltip hover text…">
<span className='demo-tooltip'>Tooltip (top-right). Hover me!</span>
</Tooltip>
</section>
<section
class="flex flex-column items-center"
style={{gap: 'var(--fluid-18)'}}
>
<Tooltip placement="left-start" label="Tooltip hover text…">
<span className='demo-tooltip'>Tooltip (left-start). Hover me!</span>
</Tooltip>
<Tooltip placement="left" label="Tooltip hover text…">
<span className='demo-tooltip'>Tooltip (left). Hover me!</span>
</Tooltip>
<Tooltip placement="left-end" label="Tooltip hover text…">
<span className='demo-tooltip'>Tooltip (left-end). Hover me!</span>
</Tooltip>
<Tooltip placement="right-start" label="Tooltip hover text…">
<span className='demo-tooltip'>Tooltip (right-start). Hover me!</span>
</Tooltip>
<Tooltip placement="right" label="Tooltip hover text…">
<span className='demo-tooltip'>Tooltip (right). Hover me!</span>
</Tooltip>
<Tooltip placement="right-end" label="Tooltip hover text…">
<span className='demo-tooltip'>Tooltip (right-end). Hover me!</span>
</Tooltip>
</section>
<section class="mbs56 mbe40 flex-inline justify-between w-100">
<Tooltip placement="bottom-start" label="Tooltip hover text…">
<span className='demo-tooltip'>Tooltip (bottom-start). Hover me!</span>
</Tooltip>
<Tooltip placement="bottom" label="Tooltip hover text…">
<span className='demo-tooltip'>Tooltip (bottom). Hover me!</span>
</Tooltip>
<Tooltip placement="bottom-end" label="Tooltip hover text…">
<span className='demo-tooltip'>Tooltip (bottom-end). Hover me!</span>
</Tooltip>
</section>
</div>
)
React: component source
Vue 3
View source
<script>
import "agnostic-vue/dist/common.min.css";
import "agnostic-vue/dist/index.css";
import { Tooltip } from "agnostic-vue";
</script>
<template>
<div class="tooltips-container">
<section class="mbs56 mbe40 flex-inline justify-between w-100">
<Tooltip placement="top-start">
Tooltip top-start
<template #content>This is the tooltip content from named slot.</template>
</Tooltip>
<Tooltip placement="top">
Tooltip top
<template #content>This is the tooltip content from named slot.</template>
</Tooltip>
<Tooltip placement="top-end">
Tooltip top-end
<template #content>This is the tooltip content from named slot.</template>
</Tooltip>
</section>
<section
class="flex flex-column items-center"
style="gap: var(--fluid-18);"
>
<Tooltip placement="left-start">
Tooltip left-start
<template #content>This is the tooltip content from named slot.</template>
</Tooltip>
<Tooltip placement="left">
Tooltip left
<template #content>This is the tooltip content from named slot.</template>
</Tooltip>
<Tooltip placement="left-end">
Tooltip left-end
<template #content>This is the tooltip content from named slot.</template>
</Tooltip>
<Tooltip placement="right-start">
Tooltip right-start
<template #content>This is the tooltip content from named slot.</template>
</Tooltip>
<Tooltip placement="right">
Tooltip right
<template #content>This is the tooltip content from named slot.</template>
</Tooltip>
<Tooltip placement="right-end">
Tooltip right-end
<template #content>This is the tooltip content from named slot.</template>
</Tooltip>
</section>
<section class="mbs56 mbe40 flex-inline justify-between w-100">
<Tooltip placement="bottom-start">
Tooltip bottom-start
<template #content>This is the tooltip content from named slot.</template>
</Tooltip>
<Tooltip placement="bottom">
Tooltip bottom
<template #content>This is the tooltip content from named slot.</template>
</Tooltip>
<Tooltip placement="bottom-end">
Tooltip bottom-end
<template #content>This is the tooltip content from named slot.</template>
</Tooltip>
</section>
</div>
</template>
Vue 3: component source, storybook tests
Svelte
Note that Tooltips is only implemneted in the `agnostic-svelte-ts` package (intended to replace agnostic-svelte at some point).
View source
<script>
// agnostic-svelte-ts, at some point, will become agnostic-svelte
import 'agnostic-svelte-ts/css/common.min.css';
import { Tooltip } from "agnostic-svelte-ts";
</script>
<div class="text-center tooltips-container">
<section class="mbs56 mbe40 flex-inline justify-between w-100">
<Tooltip placement="top-start">
Tooltip top-start
<div slot="content">This is the tooltip content from named slot.</div>
</Tooltip>
<Tooltip placement="top">
Tooltip top
<div slot="content">This is the tooltip content from named slot.</div>
</Tooltip>
<Tooltip placement="top-end">
Tooltip top-end
<div slot="content">This is the tooltip content from named slot.</div>
</Tooltip>
</section>
<section
class="flex flex-column items-center"
style="gap: var(--fluid-18);"
>
<Tooltip placement="left-start">
Tooltip left-start
<div slot="content">This is the tooltip content from named slot.</div>
</Tooltip>
<Tooltip placement="left">
Tooltip left
<div slot="content">This is the tooltip content from named slot.</div>
</Tooltip>
<Tooltip placement="left-end">
Tooltip left-end
<div slot="content">This is the tooltip content from named slot.</div>
</Tooltip>
<Tooltip placement="right-start">
Tooltip right-start
<div slot="content">This is the tooltip content from named slot.</div>
</Tooltip>
<Tooltip placement="right">
Tooltip right
<div slot="content">This is the tooltip content from named slot.</div>
</Tooltip>
<Tooltip placement="right-end">
Tooltip right-end
<div slot="content">This is the tooltip content from named slot.</div>
</Tooltip>
</section>
<section class="mbs56 mbe40 flex-inline justify-between w-100">
<Tooltip placement="bottom-start">
Tooltip bottom-start
<div slot="content">This is the tooltip content from named slot.</div>
</Tooltip>
<Tooltip placement="bottom">
Tooltip bottom
<div slot="content">This is the tooltip content from named slot.</div>
</Tooltip>
<Tooltip placement="bottom-end">
Tooltip bottom-end
<div slot="content">This is the tooltip content from named slot.</div>
</Tooltip>
</section>
</div>
Svelte (Typescript): component source
Storybook
You can run the framework Storybooks and see live examples for React, Vue 3, Svelte, Astro, and Angular (experimental). The following will set up Storybook and run locally:
How to run Storybook
git clone git@github.com:AgnosticUI/agnosticui.git
cd agnosticui/<PACKAGE_NAME> && npm i # e.g. cd agnosticui/agnostic-react && npm i
npm run storybook
See Running Storybook.