--- title: Float description: "`Float` is a component used to fix elements to the edges of a container." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/float/float.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/float - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-float--basic --- ```tsx New ``` ## Usage ```tsx import { Float } from "@yamada-ui/react" ``` ```tsx import { Float } from "@/components/ui" ``` ```tsx import { Float } from "@workspaces/ui" ``` ```tsx ``` ### Change the Display Position To change the display position, specify `placement` such as `start-start` or `end-center`. ```tsx const placements = [ "start-start", "start-center", "start-end", "center-start", "center-center", "center-end", "end-start", "end-center", "end-end", ] as const return ( {placements.map((placement) => ( New ))} ) ``` ### Change the Offset If the size of the element causes it to be positioned unexpectedly, adjust it using `offset`. ```tsx New New New ``` ## Props | Prop | Default | Type | Description | | ------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `offset` | - | `"-0.5" \| "-1.5" \| "-1" \| "-10" \| "-11" \| "-12" \| "-13" \| "-14" \| "-15" \| "-16" ...` | Changes position offset. | | `placement` | `"start-end"` | `"center-center" \| "center-end" \| "center-start" \| "center" \| "end-center" \| "end-end" \| "end-start" \| "end" \| "start-center" \| "start-end" ...` | The placement of the float. |