### MudBlazor Align Content Start Example Source: https://mudblazor.com/utilities/align-content Demonstrates the 'align-content-start' utility class in MudBlazor to align rows to the start of a flex container. This example uses MudPaper components to visualize the layout. ```html ``` -------------------------------- ### MudSelect Placement Examples Source: https://mudblazor.com/components/select Demonstrates different placement options for the MudSelect component using AnchorOrigin and TransformOrigin properties. These examples show how to control the popover's starting point and transformation relative to the input field. ```html Foo Bar Foo Bar Foo Bar ``` -------------------------------- ### Install MudBlazor Templates Source: https://mudblazor.com/getting-started/installation Installs the MudBlazor dotnet templates, which are modified versions of the Microsoft Web App template including MudBlazor components for faster project setup. ```bash dotnet new install MudBlazor.Templates ``` -------------------------------- ### MudBlazor: Basic Align Items - Start Source: https://mudblazor.com/utilities/align-items Demonstrates the basic usage of the `align-start` utility class in MudBlazor to align flex items to the start of the cross axis. This example uses MudBlazor components within a flex container. ```html ``` -------------------------------- ### MudBlazor Timeline Alignment Example Source: https://mudblazor.com/components/timeline Demonstrates how to set the starting direction for timeline dots using the `TimelineAlign` property on the `MudTimeline` component. This example shows different alignment options for timeline items. ```html Start Default End Aug 2020 MudBlazor Emerges A repository pops up on GitHub named MudBlazor. The development has already started and the most common components can be found already. Oct 2020 MudBlazor Unleashed! The first version is released and uploaded as v1.0.7. Nov 2020 First Minor MudBlazor gets its first minor with version 1.1.0. TimerPicker, AutoComplete and Charts join the library as well as T versions of our inputs and selects. ``` ```csharp @code{ private TimelineAlign _timelineAlign { get; set; } = TimelineAlign.Start; } ``` -------------------------------- ### Create New Project with MudBlazor Template Source: https://mudblazor.com/getting-started/installation Creates a new Blazor project with MudBlazor integrated, using specified interactivity mode, project name, and all interactive features. Use --help for more options. ```bash dotnet new mudblazor --interactivity Auto --name MyApplication --all-interactive dotnet new mudblazor --help ``` -------------------------------- ### Install MudBlazor NuGet Package Source: https://mudblazor.com/getting-started/installation Adds the MudBlazor library to an existing .NET project via the NuGet Package Manager. This command-line instruction is an alternative to using the GUI. ```bash dotnet add package MudBlazor ``` -------------------------------- ### MudFileUpload: Single File Upload Example Source: https://mudblazor.com/api/mudfileupload%601 Demonstrates how to use the MudFileUpload component to upload a single file using IBrowserFile. It includes basic setup and binding the uploaded file to a variable. ```csharp @using MudBlazor @using System.IO @code { private IBrowserFile uploadedFile; private void OnFilesChanged(InputFileChangeEventArgs e) { uploadedFile = e.File; // Process the uploaded file here Console.WriteLine($"File uploaded: {uploadedFile.Name}, Size: {uploadedFile.Size}"); } } ``` -------------------------------- ### MudBlazor Dropdown Settings Example (HTML) Source: https://mudblazor.com/components/popover An HTML example showcasing the integration of DropdownSettings with MudBlazor components. This includes MudSelect, MudMenu, and MudAutocomplete, demonstrating how to bind various dropdown-related properties like AnchorOrigin, TransformOrigin, and RelativeWidth. ```html Foo Bar Lorem ipsum dolor sit amet, consectetur adipiscing elit Top Left Top Center Top Right Bottom Left Bottom Center Bottom Right Center Left Center Center Center Right Top Left Top Center Top Right Bottom Left Bottom Center Bottom Right Center Left Center Center Center Right @foreach (var cursor in Cursors) { @cursor } ``` ```csharp @code { string[] Cursors = new[] { "cursor-all-scroll", "cursor-auto", "cursor-cell", "cursor-col-resize", "cursor-copy", "cursor-crosshair", "cursor-default", "cursor-grab", "cursor-grabbing", "cursor-help", "cursor-move", "cursor-no-drop", "cursor-none", "cursor-not-allowed", "cursor-n-resize", "cursor-pointer", "cursor-progress", "cursor-row-resize", "cursor-text", "cursor-url", "cursor-vertical-text", "cursor-wait", "cursor-w-resize", "cursor-zoom-in", "cursor-zoom-out" }; } ``` -------------------------------- ### MudBlazor DateRangePicker Configuration Examples Source: https://mudblazor.com/components/datepicker Demonstrates various configurations for the MudBlazor MudDateRangePicker component. Includes basic usage, editable ranges, placeholders, clearable functionality, custom date formats, custom start months, and interactive actions with buttons. ```html Clear Cancel OK AutoClose ``` ```csharp @code { private MudDateRangePicker _picker; private DateRange _dateRange = new DateRange(DateTime.Now.Date, DateTime.Now.AddDays(5).Date); private bool _autoClose; } ``` -------------------------------- ### MudBlazor ToolBar Basic and Spaced Examples Source: https://mudblazor.com/components/toolbar Demonstrates the basic usage of MudBlazor's MudToolBar component with various icon buttons. It also shows how to use MudSpacer to push content to the right and how to justify content within the toolbar. ```html ``` -------------------------------- ### MudTable Loading Content Example (C#) Source: https://mudblazor.com/api/mudtable Demonstrates how to customize the content displayed while the MudTable is loading data. This example uses `LoadingContentBody` to show a multi-row, multi-column placeholder structure. ```csharp Loading Name... Loading Age... Loading Status... Please wait while data is being fetched. @code { public class MyObject { public string Name { get; set; } public int Age { get; set; } public string Status { get; set; } } public IEnumerable MyItems { get; set; } public bool Loading { get; set; } = true; public async Task> LoadTableData(TableState state) { Loading = true; await Task.Delay(2000); // Simulate network delay var data = new List { new MyObject { Name = "Alice", Age = 30, Status = "Active" }, new MyObject { Name = "Bob", Age = 25, Status = "Inactive" }, new MyObject { Name = "Charlie", Age = 35, Status = "Active" } }; Loading = false; return new TableData { TotalItems = data.Count, Items = data }; } } ``` -------------------------------- ### Basic Flex Grow Example (HTML) Source: https://mudblazor.com/utilities/flex-grow Demonstrates the basic usage of `flex-grow-1` to allow a flex item to grow and fill available space within a flex container. This example uses MudBlazor components within an HTML structure. ```html
``` -------------------------------- ### MudBlazor Basic Flex Wrap Example Source: https://mudblazor.com/utilities/flex-wrap Demonstrates the basic usage of MudBlazor's flex wrap utility classes to control how flex items are arranged within a container. This example shows items wrapping to the next line. ```html ``` -------------------------------- ### Default MudBlazor DataGrid with Property Columns Source: https://mudblazor.com/components/datagrid Demonstrates the basic setup of a MudBlazor DataGrid using PropertyColumns to display data fetched from an API. It requires an HttpClient to fetch data and defines columns based on the properties of the 'Element' model. This example shows how to bind data and configure basic columns. ```razor @using System.Net.Http.Json @using MudBlazor.Examples.Data.Models @inject HttpClient httpClient ``` ```csharp @code { private IEnumerable Elements = new List(); protected override async Task OnInitializedAsync() { Elements = await httpClient.GetFromJsonAsync>("webapi/periodictable"); } } ``` -------------------------------- ### MudSelect Dynamic Sizing Example (Razor) Source: https://mudblazor.com/components/select This Razor code demonstrates the dynamic sizing of the MudSelect component using FullWidth and FitContent parameters. It includes examples with different configurations like outlined variant, shrink label, clearable, and adornments. It also shows how to control these parameters using MudSwitch components. ```razor @using MudBlazor @foreach (var state in _states) { @state } @foreach (var state in _states) { @state } @foreach (var state in _states) { @state } ``` -------------------------------- ### v7.0.0 Migration Guide Requirement (HTML) Source: https://mudblazor.com/mud/project/releases Illustrates the requirement to add a 'MudPopoverProvider' when migrating to v7.x.x from v6.x.x. The example shows the 'Before' and 'After' HTML structure, highlighting the addition of the MudPopoverProvider. This is a crucial migration step. ```html > [!WARNING] > It's now explicitly required to add `MudPopoverProvider`. [#8712](**#8712**) Before (v6.x.x): ```html ``` After (v7.x.x): ```html ``` For all other changes and warnings please make sure to visit the [v7.0.0 Migration Guide](https://github.com/MudBlazor/MudBlazor/issues/8447) ``` -------------------------------- ### MudBlazor DatePicker Input Masking Examples Source: https://mudblazor.com/components/datepicker Illustrates how to use input masking with the MudBlazor DatePicker for controlled date input. Examples show how to apply `DateMask` and `PatternMask` with different format strings (`dd.MM.yyyy`, `MM/dd/yyyy`, `yyyy-MM-dd`) to guide user input and ensure format consistency. The `DateFormat` parameter must align with the mask. ```blazor @code { private DateTime? _date1 = null; private DateTime? _date2 = DateTime.Today; private DateTime? _date3 = null; } ``` -------------------------------- ### MudBlazor: Open Calendar with MudOverlay and MudPopover Source: https://mudblazor.com/components/overlay Demonstrates how to open a MudDatePicker within a MudPopover, controlled by MudOverlay. Includes functionality to override the default overlay behavior using the 'mud-skip-overlay-section' class. ```html Open Calendar with Override Open Calendar without Override ``` ```csharp @code { private bool _isPopoverOpen = false; private DateTime? _selectedDate { get; set; } = DateTime.Today; private string _className = string.Empty; private void TogglePopover(bool overRide) { if (overRide) { _className = "mud-skip-overlay-section"; } else { _className = string.Empty; } _isPopoverOpen = !_isPopoverOpen; } } ``` -------------------------------- ### MudBlazor Align Content Center Example Source: https://mudblazor.com/utilities/align-content Illustrates the 'align-content-center' utility class in MudBlazor for centering rows within a flex container. The example utilizes MudPaper components for visual representation. ```html ``` -------------------------------- ### MudBlazor DatePicker Text Parsing Example Source: https://mudblazor.com/components/datepicker Demonstrates the `ImmediateText` parameter for the MudBlazor DatePicker, enabling real-time parsing of user input into a date. The example shows how to handle text changes, parse various date formats using `DateTime.TryParseExact`, and update a bound `DateTime?` variable. It includes helper text to display the parsed date or 'not set'. ```blazor @using System.Globalization @code { private DateTime? _date = null; private string _dateFormat = "dd.MM.yyyy"; private string _bound = "not set"; private void DatePickerTextChanged(string value) { if (value == null || value.Length < 6) { _date = null; } else { string[] formats = { "ddMMyy", "dd.MM.yyyy", "dd.M.yyyy", "d.MM.yyyy", "d.M.yyyy", "dd.MM.yy", "dd.M.yy", "d.MM.yy", "d.M.yy" }; if (DateTime.TryParseExact(value, formats, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime validDate)) { _date = validDate; } else { _date = null; } } if (_date.HasValue) { _bound = _date.Value.ToString(_dateFormat); } else { _bound = "not set"; } } } ``` -------------------------------- ### MudBlazor Align Self: Basic Usage Examples Source: https://mudblazor.com/utilities/align-self Demonstrates the basic usage of MudBlazor's 'align-self' utility classes to control the alignment of individual flex items. These examples showcase 'align-self-start', 'align-self-center', 'align-self-end', and 'align-self-stretch'. ```html ``` ```html ``` ```html ``` ```html ``` -------------------------------- ### Use MudOverlay as a Loader with ChildContent Source: https://mudblazor.com/components/overlay This example shows how to use MudOverlay with custom ChildContent to display loading progress. Overlays containing ChildContent are excluded from automatic scaffolding and rendered individually. This snippet requires MudBlazor components and basic Blazor concepts for state management. ```cshtml @if (!dataLoaded) { } else { Old Paint Old paint found on a stone house door. This photo was taken in a small village in Istra Croatia. Share Learn more } Refresh data Reset example ``` ```csharp @code { private bool visible; private bool dataLoaded; public async void OpenOverlay() { visible = true; dataLoaded = false; await Task.Delay(3000); dataLoaded = true; visible = false; StateHasChanged(); } public void ResetExample() { dataLoaded = false; } } ``` -------------------------------- ### No Flex Grow Example (HTML) Source: https://mudblazor.com/utilities/flex-grow Illustrates how to prevent flex items from growing using the `flex-grow-0` class. This ensures that items maintain their defined size and do not expand to fill available space. The example uses MudBlazor components. ```html
``` -------------------------------- ### MudBlazor Dialog Custom Styling Example Source: https://mudblazor.com/components/dialog Provides an example of how to apply custom CSS classes to different parts of a MudBlazor dialog, such as the title, content, and actions, for advanced styling. Uses Blazor and C#. ```csharp @inject IDialogService DialogService Open custom styled dialog ``` @code { private Task OpenDialogAsync() { var options = new DialogOptions { CloseOnEscapeKey = true, CloseButton = true }; return DialogService.ShowAsync("Styling Example Dialog", options); } } ``` ``` -------------------------------- ### MudSnackbarProvider Component Source: https://mudblazor.com/api/MudSnackbarProvider Provides information and examples for using the MudSnackbarProvider component. Visit the Snackbar page for detailed usage examples. ```APIDOC ## MudSnackbarProvider Component ### Description This component is used for displaying snackbar notifications. Refer to the Snackbar page for comprehensive usage examples and demonstrations. ### Method GET ### Endpoint /websites/mudblazor/snackbar ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) This endpoint does not return a direct response body in the traditional sense. It is primarily for accessing documentation and examples. #### Response Example None ### Properties #### Common - **Class** (string) - Optional - The CSS classes applied to this component. Defaults to `null`. Use spaces to separate multiple classes. Use the Style property to apply custom CSS styles. - **Style** (string) - Optional - The CSS styles applied to this component. Defaults to `null`. Use the Class property to apply CSS classes. - **Tag** (object) - Optional - The arbitrary object to link to this component. This property is typically used to associate additional information with this component, such as a model containing data for this component. - **UserAttributes** (Dictionary) - Optional - The additional HTML attributes to apply to this component. This property is typically used to provide additional HTML attributes during rendering such as ARIA accessibility tags or a custom ID. #### General - **FieldId** (string) - Optional - If the UserAttributes contain an ID make it accessible for WCAG labelling of input fields. - **RightToLeft** (bool) - Optional - Determines if the component should render in a right-to-left direction. ### Inheritance - ComponentBase - ComponentBaseWithState - MudComponentBase - MudSnackbarProvider ``` -------------------------------- ### MudBlazor Simple Tabs Example Source: https://mudblazor.com/components/tabs Demonstrates the basic usage of MudBlazor Tabs with multiple MudTabPanel components. Each panel contains text content and can be configured with properties like Elevation, Rounded, and ApplyEffectsToContainer. ```blazor Content One Content Two Content Three Content Disabled ``` -------------------------------- ### Install MudBlazor Translations NuGet Package Source: https://mudblazor.com/features/localization Installs the MudBlazor.Translations NuGet package, which provides crowdsourced translations for MudBlazor components. This is done via the .NET CLI. ```bash dotnet add package MudBlazor.Translations ``` -------------------------------- ### MudTableBase FooterContent Example Source: https://mudblazor.com/api/MudTableBase Provides an example of using the `FooterContent` RenderFragment property in MudTableBase for defining table footers. It shows basic footer column definitions with `MudTd` and notes the option for custom multi-row footers when `CustomFooter` is `true`. ```html Footer Col 1 Footer Col 2 ... ... ``` -------------------------------- ### Global Snackbar Configuration in MudBlazor Source: https://mudblazor.com/components/snackbar Demonstrates how to configure Snackbar behavior globally in the `Program.cs` file. This example sets properties like position, transition durations, and visibility duration for all Snackbars. ```csharp using MudBlazor.Services; services.AddMudServices(config => { config.SnackbarConfiguration.PositionClass = Defaults.Classes.Position.BottomLeft; config.SnackbarConfiguration.PreventDuplicates = false; config.SnackbarConfiguration.NewestOnTop = false; config.SnackbarConfiguration.ShowCloseIcon = true; config.SnackbarConfiguration.VisibleStateDuration = 10000; config.SnackbarConfiguration.HideTransitionDuration = 500; config.SnackbarConfiguration.ShowTransitionDuration = 500; config.SnackbarConfiguration.SnackbarVariant = Variant.Filled; }); ``` -------------------------------- ### MudBlazor DatePicker Basic Usage Examples Source: https://mudblazor.com/components/datepicker Demonstrates various configurations of the MudBlazor DatePicker component for basic date selection. Includes examples for a standard picker, editable picker with a placeholder, calendar-only view, custom date formatting, showing week numbers, and displaying two months simultaneously. It requires a `DateTime?` field for two-way binding. ```blazor @code { private DateTime? _date = DateTime.Today; } ``` -------------------------------- ### MudTable ColGroup Styling Example (HTML) Source: https://mudblazor.com/api/mudtable Shows how to use the `ColGroup` property of the MudTable component to apply specific styling to table columns. This example demonstrates setting background colors and maximum widths for columns. ```html @code { public class MyObject { public string Name { get; set; } public int Age { get; set; } public string Status { get; set; } } public IEnumerable MyItems = new List { new MyObject { Name = "Alice", Age = 30, Status = "Active" }, new MyObject { Name = "Bob", Age = 25, Status = "Inactive" }, new MyObject { Name = "Charlie", Age = 35, Status = "Active" } }; } ``` -------------------------------- ### Basic MudBlazor Theme Provider Setup Source: https://mudblazor.com/customization/overview The MudThemeProvider component sets up the default theme for MudBlazor components. No initial configuration is required, as it uses MudBlazor's default theme values. ```html ``` -------------------------------- ### MudTableBase PagerContent Example Source: https://mudblazor.com/api/MudTableBase Demonstrates how to implement pagination in MudTableBase using the `PagerContent` RenderFragment. This typically involves including a `MudTablePager` component to enable navigation between data pages. ```html ... ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.