# OuiFloat
A flexible floating element component for creating tooltips, dropdowns, popovers, and menus. Built on top of [Floating UI](https://floating-ui.com/) for intelligent positioning.
## Basic Usage
### With External Reference
```vue
Click to toggle
This is floating content
```
### With Trigger Slot
```vue
Click me
Floating content here
```
## Props
| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `reference` | `Ref` | - | External reference element for positioning |
| `transition` | `string` | `${name}-transition` | CSS transition name |
| `placement` | `Placement` | `'top'` | Initial placement (`top`, `bottom`, `left`, `right`, etc.) |
| `arrow` | `boolean` | `false` | Show arrow pointing to reference |
| `offset` | `OffsetOptions` | `0` | Distance from reference element |
| `padding` | `Padding` | `16` | Padding for boundary detection |
| `close` | `boolean` | `false` | Close on outside click or Escape key |
| `hover` | `boolean` | `false` | Show/hide on hover |
| `delayEnter` | `number` | `0` | Hover enter delay in ms |
| `delayLeave` | `number` | `250` | Hover leave delay in ms |
## Model
| Model | Type | Description |
|-------|------|-------------|
| `v-model` | `boolean` | Controls visibility of floating element |
## Events
| Event | Payload | Description |
|-------|---------|-------------|
| `close` | - | Emitted when float is closed |
| `dblclick` | `MouseEvent` | Emitted on double click |
## Slots
| Slot | Props | Description |
|------|-------|-------------|
| `default` | - | Main floating content |
| `trigger` | `{ active: boolean }` | Trigger element with auto-wiring |
| `click` | `{ active: boolean }` | Click trigger (deprecated, use `trigger`) |
| `hover` | `{ active: boolean }` | Hover trigger (not commonly used) |
## CSS Classes
The component supports predefined styling variants through CSS classes:
### `_tooltip`
```vue
Tooltip content
```
### `_dropdown`
```vue
Dropdown content
```
### `_menu`
```vue
Menu content
```
## Examples
### Tooltip
```vue
Hover me
This is a tooltip
```
### Dropdown with Form
```vue
Dropdown {{ active ? '▲' : '▼' }}
```
### Popover with Arrow
```vue
Show Popover
Popover Title
This is a popover with an arrow.
```
## Positioning
The component uses Floating UI for intelligent positioning with:
- **Auto-flipping**: Automatically flips to opposite side if no space
- **Shifting**: Moves along the axis to stay in viewport
- **Size adjustment**: Adjusts size to fit available space
- **Arrow positioning**: Automatically positions arrow to point at reference
## Interactions
- **Click outside**: Closes float when `close` prop is true
- **Escape key**: Closes float when `close` prop is true
- **Hover**: Shows/hides on hover when `hover` prop is true
- **Focus within**: Keeps float open when content has focus (with hover)
## Notes
- Uses `teleport` to render floating content in document body
- Automatically prevents body scroll interference
- Supports custom transitions through the `transition` prop
- Works with keyboard navigation and screen readers
- Arrow automatically adjusts position based on placement