Skip to content

Commit 7a178f0

Browse files
committed
Enhance Button docs and add rich enum metadata
- Improved Button component documentation: renamed and expanded sections, added enum documentation tables. - Added [AddedVersion], [DefaultValue], and [Description] attributes to all Button parameters, methods, and enums for better API documentation. - Updated XML comments for clarity and consistency; clarified default values. - Made ChildContent, LoadingTemplate, and TooltipTitle nullable. - Replaced buttons.jpg with updated buttons.png for documentation visuals.
1 parent 09f8ec1 commit 7a178f0

9 files changed

Lines changed: 377 additions & 63 deletions

File tree

BlazorBootstrap.Demo.RCL/Components/Pages/Docs/Buttons/Buttons_Doc_01_Documentation.razor

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,40 @@
1414
<img src="@imageUrl" class="img-fluid" alt="@metaTitle" />
1515
</Section>
1616

17-
<Section Class="p-0" Size="HeadingSize.H3" Name="Parameters" PageUrl="@pageUrl" Link="parameters">
17+
<Section Class="p-0" Size="HeadingSize.H3" Name="Button Parameters" PageUrl="@pageUrl" Link="button-parameters">
1818
<DocxTable TItem="Button" DocType="DocType.Parameters" />
1919
</Section>
2020

21-
<Section Class="p-0" Size="HeadingSize.H3" Name="Methods" PageUrl="@pageUrl" Link="methods">
21+
<Section Class="p-0" Size="HeadingSize.H3" Name="Button Methods" PageUrl="@pageUrl" Link="button-methods">
2222
<DocxTable TItem="Button" DocType="DocType.Methods" />
2323
</Section>
2424

25-
<Section Class="p-0" Size="HeadingSize.H3" Name="Events" PageUrl="@pageUrl" Link="events">
26-
<DocxTable TItem="Button" DocType="DocType.Events" />
25+
<Section Class="p-0" Size="HeadingSize.H3" Name="ButtonColor Enum" PageUrl="@pageUrl" Link="button-color-enum">
26+
<DocxTable TItem="ButtonColor" DocType="DocType.Enum" />
27+
</Section>
28+
29+
<Section Class="p-0" Size="HeadingSize.H3" Name="ButtonSize Enum" PageUrl="@pageUrl" Link="button-size-enum">
30+
<DocxTable TItem="ButtonSize" DocType="DocType.Enum" />
31+
</Section>
32+
33+
<Section Class="p-0" Size="HeadingSize.H3" Name="ButtonType Enum" PageUrl="@pageUrl" Link="button-type-enum">
34+
<DocxTable TItem="ButtonType" DocType="DocType.Enum" />
35+
</Section>
36+
37+
<Section Class="p-0" Size="HeadingSize.H3" Name="Position Enum" PageUrl="@pageUrl" Link="position-enum">
38+
<DocxTable TItem="Position" DocType="DocType.Enum" />
39+
</Section>
40+
41+
<Section Class="p-0" Size="HeadingSize.H3" Name="Target Enum" PageUrl="@pageUrl" Link="target-enum">
42+
<DocxTable TItem="Target" DocType="DocType.Enum" />
43+
</Section>
44+
45+
<Section Class="p-0" Size="HeadingSize.H3" Name="TooltipColor Enum" PageUrl="@pageUrl" Link="tooltip-color-enum">
46+
<DocxTable TItem="TooltipColor" DocType="DocType.Enum" />
47+
</Section>
48+
49+
<Section Class="p-0" Size="HeadingSize.H3" Name="TooltipPlacement Enum" PageUrl="@pageUrl" Link="tooltip-placement-enum">
50+
<DocxTable TItem="TooltipPlacement" DocType="DocType.Enum" />
2751
</Section>
2852

2953
@code {

BlazorBootstrap.Demo.RCL/wwwroot/images/screenshots/buttons.jpg renamed to BlazorBootstrap.Demo.RCL/wwwroot/images/screenshots/buttons.png

File renamed without changes.

blazorbootstrap/Components/Button/Button.razor.cs

Lines changed: 122 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ protected override async Task OnParametersSetAsync()
143143
/// <summary>
144144
/// Hides the loading state and enables the button.
145145
/// </summary>
146+
[AddedVersion("1.0.0")]
147+
[Description("Hides the loading state and enables the button.")]
146148
public void HideLoading()
147149
{
148150
Loading = false;
@@ -154,6 +156,8 @@ public void HideLoading()
154156
/// Shows the loading state and disables the button.
155157
/// </summary>
156158
/// <param name="text"></param>
159+
[AddedVersion("1.0.0")]
160+
[Description("Shows the loading state and disables the button.")]
157161
public void ShowLoading(string text = "")
158162
{
159163
LoadingText = text;
@@ -296,167 +300,226 @@ private void SetAttributes()
296300

297301
/// <summary>
298302
/// Gets or sets the button active state.
303+
/// <para>
304+
/// Default value is <see langword="false"/>.
305+
/// </para>
299306
/// </summary>
300-
/// <remarks>
301-
/// Default value is false.
302-
/// </remarks>
307+
[AddedVersion("1.0.0")]
308+
[DefaultValue(false)]
309+
[Description("Gets or sets the button active state.")]
303310
[Parameter]
304311
public bool Active { get; set; }
305312

306313
/// <summary>
307314
/// Gets or sets the block level button.
315+
/// <para>
316+
/// Default value is <see langword="false"/>.
317+
/// </para>
308318
/// </summary>
309-
/// <remarks>
310-
/// Default value is false.
311-
/// </remarks>
319+
[AddedVersion("1.0.0")]
320+
[DefaultValue(false)]
321+
[Description("Gets or sets the block level button.")]
312322
[Parameter]
313323
public bool Block { get; set; }
314324

315325
private string buttonTypeString => Type.ToButtonTypeString()!;
316326

317327
/// <summary>
318328
/// Gets or sets the content to be rendered within the component.
329+
/// <para>
330+
/// Default value is <see langword="null"/>.
331+
/// </para>
319332
/// </summary>
320-
/// <remarks>
321-
/// Default value is null.
322-
/// </remarks>
333+
[AddedVersion("1.0.0")]
334+
[DefaultValue(null)]
335+
[Description("Gets or sets the content to be rendered within the component.")]
336+
[ParameterTypeName("RenderFragment?")]
323337
[Parameter]
324-
public RenderFragment ChildContent { get; set; } = default!;
338+
public RenderFragment? ChildContent { get; set; }
325339

326340
/// <summary>
327341
/// Gets or sets the button color.
328-
/// </summary>
329-
/// <remarks>
342+
/// <para>
330343
/// Default value is <see cref="ButtonColor.None" />.
331-
/// </remarks>
344+
/// </para>
345+
/// </summary>
346+
[AddedVersion("1.0.0")]
347+
[DefaultValue(ButtonColor.None)]
348+
[Description("Gets or sets the button color.")]
332349
[Parameter]
333350
public ButtonColor Color { get; set; } = ButtonColor.None;
334351

335352
/// <summary>
336353
/// Gets or sets the button disabled state.
354+
/// <para>
355+
/// Default value is <see langword="false"/>.
356+
/// </para>
337357
/// </summary>
338-
/// <remarks>
339-
/// Default value is false.
340-
/// </remarks>
358+
[AddedVersion("1.0.0")]
359+
[DefaultValue(false)]
360+
[Description("Gets or sets the button disabled state.")]
341361
[Parameter]
342362
public bool Disabled { get; set; }
343363

344364
/// <summary>
345365
/// If <see langword="true" />, shows the loading spinner or a <see cref="LoadingTemplate" />.
366+
/// <para>
367+
/// Default value is <see langword="false"/>.
368+
/// </para>
346369
/// </summary>
347-
/// <remarks>
348-
/// Default value is false.
349-
/// </remarks>
370+
[AddedVersion("1.0.0")]
371+
[DefaultValue(false)]
372+
[Description("If <b>true</b>, shows the loading spinner or a <b>LoadingTemplate</b>.")]
350373
[Parameter]
351374
public bool Loading { get; set; }
352375

353376
/// <summary>
354377
/// Gets or sets the button loading template.
378+
/// <para>
379+
/// Default value is <see langword="null"/>.
380+
/// </para>
355381
/// </summary>
356-
/// <remarks>
357-
/// Default value is null.
358-
/// </remarks>
382+
[AddedVersion("1.0.0")]
383+
[DefaultValue(null)]
384+
[Description("Gets or sets the button loading template.")]
385+
[ParameterTypeName("RenderFragment?")]
359386
[Parameter]
360-
public RenderFragment LoadingTemplate { get; set; } = default!;
387+
public RenderFragment? LoadingTemplate { get; set; }
361388

362389
/// <summary>
363-
/// Gets or sets the loading text.
364-
/// <see cref="LoadingTemplate" /> takes precedence.
365-
/// </summary>
366-
/// <remarks>
390+
/// Gets or sets the loading text. <see cref="LoadingTemplate" /> takes precedence.
391+
/// <para>
367392
/// Default value is 'Loading...'.
368-
/// </remarks>
393+
/// </para>
394+
/// </summary>
395+
[AddedVersion("1.0.0")]
396+
[DefaultValue("Loading...")]
397+
[Description("Gets or sets the loading text. <b>LoadingTemplate</b> takes precedence.")]
398+
[ParameterTypeName("")]
369399
[Parameter]
370400
public string LoadingText { get; set; } = "Loading...";
371401

372402
/// <summary>
373403
/// Gets or sets the button outline.
404+
/// <para>
405+
/// Default value is <see langword="false"/>.
406+
/// </para>
374407
/// </summary>
375-
/// <remarks>
376-
/// Default value is false.
377-
/// </remarks>
408+
[AddedVersion("1.0.0")]
409+
[DefaultValue(false)]
410+
[Description("Gets or sets the button outline.")]
378411
[Parameter]
379412
public bool Outline { get; set; }
380413

381414
/// <summary>
382415
/// Gets or sets the position.
383416
/// Use <see cref="Position" /> to modify a <see cref="Badge" /> and position it in the corner of a link or button.
384-
/// </summary>
385-
/// <remarks>
417+
/// <para>
386418
/// Default value is <see cref="Position.None" />.
387-
/// </remarks>
419+
/// </para>
420+
/// </summary>
421+
[AddedVersion("1.0.0")]
422+
[DefaultValue(Position.None)]
423+
[Description("Gets or sets the position. Use <b>Position</b> to modify a <b>Badge</b> and position it in the corner of a link or button.")]
388424
[Parameter]
389425
public Position Position { get; set; } = Position.None;
390426

391427
/// <summary>
392428
/// Gets or sets the button size.
393-
/// </summary>
394-
/// <remarks>
429+
/// <para>
395430
/// Default value is <see cref="ButtonSize.None" />.
396-
/// </remarks>
431+
/// </para>
432+
/// </summary>
433+
[AddedVersion("1.0.0")]
434+
[DefaultValue(ButtonSize.None)]
435+
[Description("Gets or sets the button size.")]
397436
[Parameter]
398437
public ButtonSize Size { get; set; } = ButtonSize.None;
399438

400439
/// <summary>
401440
/// Gets or sets the button tab index.
441+
/// <para>
442+
/// Default value is <see langword="null"/>.
443+
/// </para>
402444
/// </summary>
403-
/// <remarks>
404-
/// Default value is null.
405-
/// </remarks>
445+
[AddedVersion("1.0.0")]
446+
[DefaultValue(null)]
447+
[Description("Gets or sets the button tab index.")]
448+
[ParameterTypeName("int?")]
406449
[Parameter]
407450
public int? TabIndex { get; set; }
408451

409452
/// <summary>
410453
/// Gets or sets the link button target.
411-
/// </summary>
412-
/// <remarks>
454+
/// <para>
413455
/// Default value is <see cref="Target.None" />
414-
/// </remarks>
456+
/// </para>
457+
/// </summary>
458+
[AddedVersion("1.0.0")]
459+
[DefaultValue(Target.None)]
460+
[Description("Gets or sets the link button target.")]
415461
[Parameter]
416462
public Target Target { get; set; } = Target.None;
417463

418464
/// <summary>
419465
/// Gets or sets the link button href attribute.
466+
/// <para>
467+
/// Default value is <see langword="null"/>.
468+
/// </para>
420469
/// </summary>
421-
/// <remarks>
422-
/// Default value is null.
423-
/// </remarks>
470+
[AddedVersion("1.0.0")]
471+
[DefaultValue(null)]
472+
[Description("Gets or sets the link button href attribute.")]
473+
[ParameterTypeName("string?")]
424474
[Parameter]
425475
public string? To { get; set; }
426476

427477
/// <summary>
428478
/// Gets or sets the button tooltip color.
429-
/// </summary>
430-
/// <remarks>
479+
/// <para>
431480
/// Default value is <see cref="TooltipColor.None" />.
432-
/// </remarks>
481+
/// </para>
482+
/// </summary>
483+
[AddedVersion("1.10.0")]
484+
[DefaultValue(TooltipColor.None)]
485+
[Description("Gets or sets the button tooltip color.")]
433486
[Parameter]
434487
public TooltipColor TooltipColor { get; set; } = TooltipColor.None;
435488

436489
/// <summary>
437490
/// Gets or sets the button tooltip placement.
438-
/// </summary>
439-
/// <remarks>
491+
/// <para>
440492
/// Default value is <see cref="TooltipPlacement.Top" />.
441-
/// </remarks>
493+
/// </para>
494+
/// </summary>
495+
[AddedVersion("1.0.0")]
496+
[DefaultValue(TooltipPlacement.Top)]
497+
[Description("Gets or sets the button tooltip placement.")]
442498
[Parameter]
443499
public TooltipPlacement TooltipPlacement { get; set; } = TooltipPlacement.Top;
444500

445501
/// <summary>
446502
/// Gets or sets the button tooltip title.
503+
/// <para>
504+
/// Default value is <see langword="null"/>.
505+
/// </para>
447506
/// </summary>
448-
/// <remarks>
449-
/// Default value is null.
450-
/// </remarks>
507+
[AddedVersion("1.0.0")]
508+
[DefaultValue(null)]
509+
[Description("Gets or sets the button tooltip title.")]
510+
[ParameterTypeName("string?")]
451511
[Parameter]
452-
public string TooltipTitle { get; set; } = default!;
512+
public string? TooltipTitle { get; set; }
453513

454514
/// <summary>
455515
/// Gets or sets the button type.
456-
/// </summary>
457-
/// <remarks>
516+
/// <para>
458517
/// Default value is <see cref="ButtonType.Button" />.
459-
/// </remarks>
518+
/// </para>
519+
/// </summary>
520+
[AddedVersion("1.0.0")]
521+
[DefaultValue(ButtonType.Button)]
522+
[Description("Gets or sets the button type.")]
460523
[Parameter]
461524
public ButtonType Type { get; set; } = ButtonType.Button;
462525

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,49 @@
11
namespace BlazorBootstrap;
22

3+
/// <summary>
4+
/// Defines the supported size options for a BlazorBootstrap button.
5+
/// </summary>
36
public enum ButtonSize
47
{
8+
/// <summary>
9+
/// Indicates that the default size is used.
10+
/// </summary>
11+
[AddedVersion("1.0.0")]
12+
[Description("Indicates that the default size is used.")]
513
None,
14+
15+
/// <summary>
16+
/// Indicates an extra-small size option.
17+
/// </summary>
18+
[AddedVersion("1.0.0")]
19+
[Description("Indicates an extra-small size option.")]
620
ExtraSmall,
21+
22+
/// <summary>
23+
/// Indicates a small size option.
24+
/// </summary>
25+
[AddedVersion("1.0.0")]
26+
[Description("Indicates a small size option.")]
727
Small,
28+
29+
/// <summary>
30+
/// Indicates a medium size option.
31+
/// </summary>
32+
[AddedVersion("1.0.0")]
33+
[Description("Indicates a medium size option.")]
834
Medium,
35+
36+
/// <summary>
37+
/// Indicates a large size option.
38+
/// </summary>
39+
[AddedVersion("1.0.0")]
40+
[Description("Indicates a large size option.")]
941
Large,
42+
43+
/// <summary>
44+
/// Indicates an extra-large size option.
45+
/// </summary>
46+
[AddedVersion("1.0.0")]
47+
[Description("Indicates an extra-large size option.")]
1048
ExtraLarge
1149
}

0 commit comments

Comments
 (0)