Basic Floating Action Button
A round, fixed icon button for the one action a screen is really about - with a ring that survives any backdrop.
6 个框架初级
A compact 44px FAB - trimmed to the minimum comfortable touch target and no smaller.
<!--
A mini FAB is 44px, not smaller - that is the minimum comfortable touch target,
so "mini" trims the standard 56px to the floor and stops. The aria-label is
still the whole accessible name; the smaller glyph does not change that.
-->
<button type="button" aria-label="Add item" class="fixed bottom-6 right-6 z-40 inline-flex h-11 w-11 items-center justify-center rounded-full bg-blue-600 text-white shadow-[0_8px_20px_-6px_rgba(15,23,42,0.4)] transition hover:bg-blue-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 focus-visible:ring-offset-white motion-safe:hover:-translate-y-px disabled:pointer-events-none disabled:opacity-50 dark:bg-blue-500 dark:hover:bg-blue-400 dark:focus-visible:ring-blue-400 dark:focus-visible:ring-offset-gray-950">
<svg class="h-5 w-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true" focusable="false"><path d="M12 5v14M5 12h14" /></svg>
</button>| Prop | 类型 | 默认值 | 说明 |
|---|---|---|---|
ariaLabel必填 | string | - | 按钮的无障碍名称。仅有图标的按钮必须设置。 |
icon | ReactNode | - | 与内容并排渲染的图标元素。 |
onClick | () => void | - | 用户激活控件时触发。 |
disabled | boolean | false | 禁止交互并将控件置灰。 |
A mini FAB is 44px, not smaller: that is the floor for a comfortable touch target, so "mini" trims the standard 56px to the minimum and stops. The `aria-label` remains the whole accessible name; the smaller glyph does not change that.