Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to specify type on MatIconButton. Fixes #315 #325

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@if (IsShowingClearButton)
{
<div class="mat-autocomplete-list-clearbutton">
<MatIconButton Icon="clear" OnMouseDown="@ClearText"></MatIconButton>
<MatIconButton Type="button" Icon="clear" OnMouseDown="@ClearText"></MatIconButton>
enkodellc marked this conversation as resolved.
Show resolved Hide resolved
</div>
}
@if (Items != null && IsOpened)
Expand Down
7 changes: 7 additions & 0 deletions src/MatBlazor/Components/MatIconButton/BaseMatIconButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ public bool Toggled
[Parameter]
public EventCallback<bool> ToggledChanged { get; set; }

/// <summary>
/// The default behavior of the button. Possible values are:
/// "button", "reset", "submit"
/// </summary>
[Parameter]
public string Type { get; set; }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good to set the default to "button" ??

public string Type { get; set; } = "button";


/// <summary>
/// Navigate to this url when clicked.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/MatBlazor/Components/MatIconButton/MatIconButton.razor
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@namespace MatBlazor
@inherits BaseMatIconButton

<button type="button" class="@ClassMapper.AsString()" style="@StyleMapper.AsString()" @ref="Ref" disabled=@Disabled @onclick="OnClickHandler" @onclick:stopPropagation=@OnClickStopPropagation @onmousedown="OnMouseDown" href=@Link @attributes="Attributes" Id="@Id">
<button type=@Type class="@ClassMapper.AsString()" style="@StyleMapper.AsString()" @ref="Ref" disabled=@Disabled @onclick="OnClickHandler" @onclick:stopPropagation=@OnClickStopPropagation @onmousedown="OnMouseDown" href=@Link @attributes="Attributes" Id="@Id">
@if (Icon != null)
{
@if (ToggleIcon != null && Toggled)
Expand Down
6 changes: 6 additions & 0 deletions src/MatBlazor/MatBlazor.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.