|
| 1 | +--- |
| 2 | +title: Overview |
| 3 | +page_title: Floating Action Button Overview |
| 4 | +description: Discover the FloatingActionButton component for Blazor. Learn how to add the component to your app and explore its configuration options, such as positioning and alignment. |
| 5 | +slug: fab-overview |
| 6 | +tags: telerik,blazor,floating action button |
| 7 | +published: True |
| 8 | +position: 0 |
| 9 | +--- |
| 10 | + |
| 11 | +# Blazor Floating Action Button Overview |
| 12 | + |
| 13 | +The <a href="https://www.telerik.com/blazor-ui/floating-action-button" target="_blank">Blazor Floating Action Button</a> is a UI component that shows over the other page content and may not move during scrolling. The component can perform the most logical action expected from a user looking at a particular screen. You can configure the FloatingActionButton to display: |
| 14 | + |
| 15 | +* A single button with a single action |
| 16 | +* Additional related actions |
| 17 | +* Speed dial actions |
| 18 | + |
| 19 | +The Floating Action Button comes with built-in customization features that lets you fine-tune the [positioning and alignment](slug://fab-positions) of the component, customize its [appearance](slug://fab-appearance), use icons, and attach click [events](slug://fab-events). |
| 20 | + |
| 21 | +## Creating Blazor Floating Action Button |
| 22 | + |
| 23 | +1. Use the `<TelerikFloatingActionButton>` tag to add the component to your razor page. |
| 24 | +2. (optional) Customize the [appearance](slug://fab-appearance) of the Telerik Blazor Floating Action Button. |
| 25 | + |
| 26 | +>caption Basic Blazor Floating Action Button |
| 27 | +
|
| 28 | +````RAZOR |
| 29 | +Current time: @Result |
| 30 | +<TelerikFloatingActionButton Size="@ThemeConstants.Button.Size.Large" |
| 31 | + VerticalAlign="@FloatingActionButtonVerticalAlign.Top" |
| 32 | + HorizontalAlign="@FloatingActionButtonHorizontalAlign.Center" |
| 33 | + ThemeColor="@ThemeConstants.Button.ThemeColor.Info" |
| 34 | + Icon="@SvgIcon.Clock" |
| 35 | + OnClick="@HandleClickEvent" /> |
| 36 | +@code { |
| 37 | + private string Result { get; set; } = DateTime.Now.ToString("HH:MM:ss:fff"); |
| 38 | +
|
| 39 | + private void HandleClickEvent() |
| 40 | + { |
| 41 | + Result = DateTime.Now.ToString("HH:MM:ss:fff"); |
| 42 | + } |
| 43 | +} |
| 44 | +```` |
| 45 | + |
| 46 | +## Position and Alignment |
| 47 | + |
| 48 | +You can control how the Floating Action Button is positioned relative to its associated container. Read more about the [Blazor Floating Action Button positioning...](slug://fab-positions) |
| 49 | + |
| 50 | +## Events |
| 51 | + |
| 52 | +The Blazor Floating Action Button fires events that you can handle and respond to user actions. [Read more about the Blazor Floating Action Button events...](slug://fab-events). |
| 53 | + |
| 54 | +## Floating Action Button Parameters |
| 55 | + |
| 56 | +The Blazor Floating Action Button provides various parameters that allow you to configure the component. Also check the [Floating Action Button public API](slug:Telerik.Blazor.Components.TelerikFloatingActionButton). |
| 57 | + |
| 58 | +@[template](/_contentTemplates/common/parameters-table-styles.md#table-layout) |
| 59 | + |
| 60 | +| Parameter | Type and Default Value | Description | |
| 61 | +| --- | --- | --- | |
| 62 | +| `Enabled` | `bool` <br /> (`true`) | Whether the Floating Action Button is enabled. | |
| 63 | +| `Id` | `string` | The `id` attribute of the Floating Action Button. | |
| 64 | +| `Icon` | `object` | The icon rendered in the Floating Action Button. Can be set to a predefined Telerik icon or a custom one. | |
| 65 | +| `Title` | `string` | The `title` attribute of the Floating Action Button. | |
| 66 | +| `PositionMode` | `FloatingActionButtonPositionMode` enum <br /> (`Fixed`) | The position of the Floating Action Button relative to the container. | |
| 67 | +| `HorizontalAlign` | `FloatingActionButtonHorizontalAlign` <br /> (`End`) | Determines if the left or the right side of the Floating Action Button will touch its parent container. [Read more about Floating Action Button positioning.](slug://fab-positions) | |
| 68 | +| `VerticalAlign` | `FloatingActionButtonVerticalAlign` <br /> (`Bottom`) | Determines if the Floating Action Button will touch the parent container with its top or bottom side. | |
| 69 | +| `HorizontalOffset` | `string` <br /> (`16px`) | The horizontal offset value added to the button position, creating a blank space between the button and the parent. | |
| 70 | +| `VerticalOffset` | `string` <br /> (`16px`) | The vertical offset value added to the button position, creating a blank space between the button and the parent. | |
| 71 | + |
| 72 | +### Styling and Appearance |
| 73 | + |
| 74 | +The following parameters enable you to customize the appearance of the Blazor Floating Action Button: |
| 75 | + |
| 76 | +| Parameter | Type | Description | |
| 77 | +| --- | --- | --- | |
| 78 | +| `Class` | `string` | Defines the custom CSS class rendered on `<button class="k-fab">`, which is the main wrapping element of the Floating Action Button component. Use it for [styling customizations](slug://themes-override). | |
| 79 | +| `Rounded` | `string` <br /> `"full"` | Defines how rounded the borders of the Floating Action Button are. Use predefined value constants from the static class `Telerik.Blazor.ThemeConstants.Button.Rounded`. | |
| 80 | +| `Size` | `string` <br /> (`"md"`) | Sets the size of the Floating Action Button. Set it to a predefined value constant from the static class `Telerik.Blazor.ThemeConstants.Button.Size`. | |
| 81 | +| `ThemeColor` | `string` <br /> (`"primary"`) | Adjusts the background color of the Floating Action Button. Use predefined values from the static class `Telerik.Blazor.ThemeConstants.Button.ThemeColor`. | |
| 82 | + |
| 83 | + |
| 84 | +## Next Steps |
| 85 | + |
| 86 | +* [Explore the Floating Action Button Positioning and Alignment Settings](slug://fab-positions) |
| 87 | +* [Customize the Floating Action Button Appearance](slug://fab-appearance) |
| 88 | + |
| 89 | +## See Also |
| 90 | + |
| 91 | +* [Live Demo: Floating Action Button](https://demos.telerik.com/blazor-ui/floatingactionbutton/overview) |
| 92 | +* [Floating Action Button Events](slug://fab-events) |
| 93 | +* [Floating Action Button API Reference](/blazor-ui/api/Telerik.Blazor.Components.TelerikFloatingActionButton) |
0 commit comments