-
Notifications
You must be signed in to change notification settings - Fork 468
Expand file tree
/
Copy pathFluentSplitButton.razor.cs
More file actions
135 lines (113 loc) · 4.66 KB
/
FluentSplitButton.razor.cs
File metadata and controls
135 lines (113 loc) · 4.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
// ------------------------------------------------------------------------
// This file is licensed to you under the MIT License.
// ------------------------------------------------------------------------
//using Microsoft.AspNetCore.Components;
//using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
namespace Microsoft.FluentUI.AspNetCore.Components;
/// <summary>
/// The FluentSplitButton component allows users to combine a button with a menu where the left part triggers a primary action and the right part opens a menu with secondary actions.
/// is often found inside forms, dialogs, drawers (panels) and/or pages.
/// </summary>
public partial class FluentSplitButton : FluentComponentBase
{
/// <summary />
public FluentSplitButton(LibraryConfiguration configuration) : base(configuration) { }
/// <summary />
protected string? ClassValue => DefaultClassBuilder
.Build();
/// <summary />
protected string? StyleValue => DefaultStyleBuilder
.AddStyle("--menu-max-height", Height, when: !string.IsNullOrEmpty(Height))
.Build();
/// <summary>
/// Gets or sets the shape of the button.
/// The default value is `null`. Internally the component uses <see cref="ButtonShape.Rounded"/> as its default value.
/// </summary>
[Parameter]
public ButtonShape? Shape { get; set; }
/// <summary>
/// Gets or sets the size of the button.
/// The default value is `null`. Internally the component uses <see cref="ButtonSize.Medium"/> as its default value.
/// </summary>
[Parameter]
public ButtonSize? Size { get; set; }
/// <summary>
/// Gets or sets the name of the element.
/// Allows access by name from the associated form.
/// </summary>
[Parameter]
public string? Name { get; set; }
/// <summary>
/// Gets or sets the visual appearance.
/// The default value is `null`. Internally the component uses <see cref="ButtonAppearance.Outline"/> as its default value.
/// </summary>
[Parameter]
public ButtonAppearance? Appearance { get; set; }
/// <summary>
/// Gets or sets the background color of this button (overrides the <see cref="Appearance"/> property).
/// Set the value `rgba(0, 0, 0, 0)` to display a transparent button.
/// </summary>
[Parameter]
public string? BackgroundColor { get; set; }
/// <summary>
/// Gets or sets the color of the font (overrides the <see cref="Appearance"/> property).
/// </summary>
[Parameter]
public string? Color { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the button renders icon-only (no visible text label).
/// Typically used when <see cref="IconStart"/> is set and no text label is needed.
/// </summary>
[Parameter]
public bool IconOnly { get; set; }
/// <summary>
/// Gets or sets the <see cref="Icon"/> displayed at the start of button content.
/// </summary>
[Parameter]
public Icon? IconStart { get; set; }
///// <summary>
///// Gets or sets the <see cref="Icon"/> displayed at the end of button content.
///// </summary>
// This can be enabled once the web components have been fixed
//[Parameter]
//public Icon? IconToggle { get; set; }
/// <summary>
/// Gets or sets the title of the button.
/// The text usually displayed in a `tooltip` popup when the mouse is over the button.
/// </summary>
[Parameter]
public string? Title { get; set; }
/// <summary>
/// Gets or sets the plain-text label rendered inside the primary button area (e.g., <c>Label="Save"</c>).
/// For rich content such as icons or custom markup, use <see cref="ChildContent"/> instead.
/// </summary>
[Parameter]
public string? Label { get; set; }
/// <summary>
/// Gets or sets the max height of the menu, e.g. 300px
/// </summary>
[Parameter]
public string? Height { get; set; }
/// <summary>
/// Gets or sets the content to be rendered inside the component.
/// </summary>
[Parameter]
public RenderFragment? ChildContent { get; set; }
/// <summary>
/// Command executed when the user clicks on the button.
/// </summary>
[Parameter]
public EventCallback<MouseEventArgs> OnClick { get; set; }
/// <summary>
/// Raised when a FluentMenuItem is clicked.
/// </summary>
[Parameter]
public EventCallback<MenuItemEventArgs> OnMenuClick { get; set; }
/// <summary>
/// Raised when a FluentMenuItem's Checked state changes.
/// </summary>
[Parameter]
public EventCallback<MenuItemEventArgs> OnMenuCheckedChanged { get; set; }
}