|
| 1 | +--- |
| 2 | +title: Appearance |
| 3 | +page_title: DropDownButton - Appearance |
| 4 | +description: Explore the appearance settings of the DropDownButton for Blazor. See the supproted built-in options for the primary button - fill mode, roundness, size and color. |
| 5 | +slug: dropdownbutton-appearance |
| 6 | +tags: telerik,blazor,dropdownbutton,appearance,styling |
| 7 | +published: True |
| 8 | +position: 10 |
| 9 | +--- |
| 10 | + |
| 11 | +# DropDownButton Appearance |
| 12 | + |
| 13 | +This article describes the declarative settings of the DropDownButton component, which affect the styling and appearance of the primary button. |
| 14 | + |
| 15 | +The DropDownButton provides the same appearance parameters as the regular [Button component]({%slug button-appearance%}): |
| 16 | + |
| 17 | +* [FillMode](#fillmode) |
| 18 | +* [Rounded](#rounded) |
| 19 | +* [Size](#size) |
| 20 | +* [ThemeColor](#themecolor) |
| 21 | + |
| 22 | + |
| 23 | +## Setting Parameter Values |
| 24 | + |
| 25 | +The examples in this article use reflection to show all possible values of the DropDownButton parameters. In a real-world scenario, you can use two options to set the desired parameter values: |
| 26 | + |
| 27 | +* Use the static class members in the `ThemeConstants.DropDownButton` namespace. This is the easier and recommended approach. |
| 28 | +* Set the actual string values directly. |
| 29 | + |
| 30 | +The following two configurations will produce the same result. |
| 31 | + |
| 32 | +>caption Two ways to set DropDownButton appearance parameters |
| 33 | +
|
| 34 | +````CSHTML |
| 35 | +<TelerikDropDownButton FillMode="@ThemeConstants.DropDownButton.FillMode.Solid" |
| 36 | + Rounded="@ThemeConstants.DropDownButton.Rounded.Large" |
| 37 | + Size="@ThemeConstants.DropDownButton.Size.Large" |
| 38 | + ThemeColor="@ThemeConstants.DropDownButton.ThemeColor.Primary"> |
| 39 | + <DropDownButtonContent> Foo </DropDownButtonContent> |
| 40 | + <DropDownButtonItems> |
| 41 | + <DropDownButtonItem> Bar </DropDownButtonItem> |
| 42 | + </DropDownButtonItems> |
| 43 | +</TelerikDropDownButton> |
| 44 | +
|
| 45 | +<TelerikDropDownButton FillMode="solid" |
| 46 | + Rounded="lg" |
| 47 | + Size="lg" |
| 48 | + ThemeColor="primary"> |
| 49 | + <DropDownButtonContent> Foo </DropDownButtonContent> |
| 50 | + <DropDownButtonItems> |
| 51 | + <DropDownButtonItem> Bar </DropDownButtonItem> |
| 52 | + </DropDownButtonItems> |
| 53 | +</TelerikDropDownButton> |
| 54 | +```` |
| 55 | + |
| 56 | + |
| 57 | +## FillMode |
| 58 | + |
| 59 | +The `FillMode` parameter controls if the primary button of the DropDownButton component will have a background and borders. The setting also affects the component's hover state. To set the parameter value, use the `string` members of the static class `ThemeConstants.DropDownButton.FillMode`. |
| 60 | + |
| 61 | +| `FillMode` Class Member | String Value | |
| 62 | +| --- | --- | |
| 63 | +| `Solid` (default) | `"solid"` | |
| 64 | +| `Flat` | `"flat"` | |
| 65 | +| `Outline` | `"outline"` | |
| 66 | +| `Link` | `"link"` | |
| 67 | + |
| 68 | +>caption DropDownButton FillMode example |
| 69 | +
|
| 70 | +````CSHTML |
| 71 | +<p>DropDownButton FillMode</p> |
| 72 | +
|
| 73 | +@foreach (var item in FillModes) |
| 74 | +{ |
| 75 | + var fillMode = item.GetValue(null).ToString(); |
| 76 | +
|
| 77 | + <TelerikDropDownButton FillMode="@fillMode"> |
| 78 | + <DropDownButtonContent> @fillMode </DropDownButtonContent> |
| 79 | + <DropDownButtonItems> |
| 80 | + <DropDownButtonItem> secondary </DropDownButtonItem> |
| 81 | + </DropDownButtonItems> |
| 82 | + </TelerikDropDownButton> |
| 83 | +} |
| 84 | +
|
| 85 | +@code { |
| 86 | + private List<System.Reflection.FieldInfo> FillModes { get; set; } |
| 87 | +
|
| 88 | + protected override void OnInitialized() |
| 89 | + { |
| 90 | + FillModes = typeof(ThemeConstants.DropDownButton.FillMode) |
| 91 | + .GetFields().ToList(); |
| 92 | +
|
| 93 | + base.OnInitialized(); |
| 94 | + } |
| 95 | +} |
| 96 | +```` |
| 97 | + |
| 98 | + |
| 99 | +## Rounded |
| 100 | + |
| 101 | +The `Rounded` parameter affects the `border-radius` CSS styles of the DropDownButton's primary button. To set the parameter value, use the `string` members of the static class `ThemeConstants.DropDownButton.Rounded`. |
| 102 | + |
| 103 | +| `Rounded` Class Member | String Value | |
| 104 | +| --- | --- | |
| 105 | +| `Small` | `"sm"` | |
| 106 | +| `Medium` (default) | `"md"` | |
| 107 | +| `Large` | `"lg"` | |
| 108 | +| `Full` | `"full"` | |
| 109 | + |
| 110 | +>caption DropDownButton Rounded example |
| 111 | +
|
| 112 | +````CSHTML |
| 113 | +<p>DropDownButton Rounded</p> |
| 114 | +
|
| 115 | +@foreach (var item in RoundedOptions) |
| 116 | +{ |
| 117 | + var rounded = item.GetValue(null).ToString(); |
| 118 | +
|
| 119 | + <TelerikDropDownButton Rounded="@rounded"> |
| 120 | + <DropDownButtonContent> @rounded </DropDownButtonContent> |
| 121 | + <DropDownButtonItems> |
| 122 | + <DropDownButtonItem> secondary </DropDownButtonItem> |
| 123 | + </DropDownButtonItems> |
| 124 | + </TelerikDropDownButton> |
| 125 | +} |
| 126 | +
|
| 127 | +@code { |
| 128 | + private List<System.Reflection.FieldInfo> RoundedOptions { get; set; } |
| 129 | +
|
| 130 | + protected override void OnInitialized() |
| 131 | + { |
| 132 | + RoundedOptions = typeof(ThemeConstants.DropDownButton.Rounded) |
| 133 | + .GetFields().ToList(); |
| 134 | +
|
| 135 | + base.OnInitialized(); |
| 136 | + } |
| 137 | +} |
| 138 | +```` |
| 139 | + |
| 140 | +## Size |
| 141 | + |
| 142 | +The `Size` parameter can change some dimensions of the DropDownButton's primary button, such as height, margins, or paddings. Possible values are the `string` members of the static class `ThemeConstants.DropDownButton.Size`. |
| 143 | + |
| 144 | +| `Size` Class Member | String Value | |
| 145 | +| --- | --- | |
| 146 | +| `Small` | `"sm"` | |
| 147 | +| `Medium` (default) | `"md"` | |
| 148 | +| `Large` | `"lg"` | |
| 149 | + |
| 150 | +>caption DropDownButton Size example |
| 151 | +
|
| 152 | +````CSHTML |
| 153 | +<p>DropDownButton Size</p> |
| 154 | +
|
| 155 | +@foreach (var item in Sizes) |
| 156 | +{ |
| 157 | + var size = item.GetValue(null).ToString(); |
| 158 | +
|
| 159 | + <TelerikDropDownButton Size="@size"> |
| 160 | + <DropDownButtonContent> @size </DropDownButtonContent> |
| 161 | + <DropDownButtonItems> |
| 162 | + <DropDownButtonItem> secondary </DropDownButtonItem> |
| 163 | + </DropDownButtonItems> |
| 164 | + </TelerikDropDownButton> |
| 165 | +} |
| 166 | +
|
| 167 | +@code { |
| 168 | + private List<System.Reflection.FieldInfo> Sizes { get; set; } |
| 169 | +
|
| 170 | + protected override void OnInitialized() |
| 171 | + { |
| 172 | + Sizes = typeof(ThemeConstants.DropDownButton.Size) |
| 173 | + .GetFields().ToList(); |
| 174 | +
|
| 175 | + base.OnInitialized(); |
| 176 | + } |
| 177 | +} |
| 178 | +```` |
| 179 | + |
| 180 | + |
| 181 | +## ThemeColor |
| 182 | + |
| 183 | +The `ThemeColor` parameter sets the background and text color of the DropDownButton's primary button from a set of predefined options. Use the `string` members of the static class `ThemeConstants.DropDownButton.ThemeColor`. |
| 184 | + |
| 185 | +| `ThemeColor` Class Member | String Value | |
| 186 | +| --- | --- | |
| 187 | +| `Base` (default) | `"base"` | |
| 188 | +| `Primary` | `"primary"` | |
| 189 | +| `Secondary` | `"secondary"` | |
| 190 | +| `Tertiary` | `"tertiary"` | |
| 191 | +| `Info` | `"info"` | |
| 192 | +| `Success` | `"success"` | |
| 193 | +| `Warning` | `"warning"` | |
| 194 | +| `Error` | `"error"` | |
| 195 | +| `Dark` | `"dark"` | |
| 196 | +| `Light` | `"light"` | |
| 197 | +| `Inverse` | `"inverse"` | |
| 198 | + |
| 199 | +>caption DropDownButton ThemeColor example |
| 200 | +
|
| 201 | +````CSHTML |
| 202 | +<p>DropDownButton ThemeColor</p> |
| 203 | +
|
| 204 | +@foreach (var item in ThemeColors) |
| 205 | +{ |
| 206 | + var themeColor = item.GetValue(null).ToString(); |
| 207 | +
|
| 208 | + <TelerikDropDownButton ThemeColor="@themeColor"> |
| 209 | + <DropDownButtonContent> @themeColor </DropDownButtonContent> |
| 210 | + <DropDownButtonItems> |
| 211 | + <DropDownButtonItem> secondary </DropDownButtonItem> |
| 212 | + </DropDownButtonItems> |
| 213 | + </TelerikDropDownButton> |
| 214 | +} |
| 215 | +
|
| 216 | +@code { |
| 217 | + private List<System.Reflection.FieldInfo> ThemeColors { get; set; } |
| 218 | +
|
| 219 | + protected override void OnInitialized() |
| 220 | + { |
| 221 | + ThemeColors = typeof(ThemeConstants.DropDownButton.ThemeColor) |
| 222 | + .GetFields().ToList(); |
| 223 | +
|
| 224 | + base.OnInitialized(); |
| 225 | + } |
| 226 | +} |
| 227 | +```` |
| 228 | + |
| 229 | +@[template](/_contentTemplates/common/themebuilder-section.md#appearance-themebuilder) |
| 230 | + |
| 231 | +## Next Steps |
| 232 | + |
| 233 | +* [Handle DropDownButton Events]({%slug dropdownbutton-events%}) |
| 234 | +* [Add DropDownButton Icons]({%slug dropdownbutton-icons%}) |
| 235 | + |
| 236 | + |
| 237 | +## See Also |
| 238 | + |
| 239 | +* [Live Demo: DropDownButton Appearance](https://demos.telerik.com/blazor-ui/dropdownbutton/appearance) |
| 240 | +* [DropDownButton API](/blazor-ui/api/Telerik.Blazor.Components.TelerikDropDownButton) |
0 commit comments