0

Given:

<Input Date class="form-control" @bind-Value="item.Birthday" />

How do I prevent the datepicker from popping up, while still taking advantage of the date masking?

Carl Sagan
  • 982
  • 1
  • 13
  • 34

1 Answers1

1

The solution requires CSS and is not specific to Blazor.

But here is some sample code written in Blazor that I tested and verified in Google Chrome:

@page "/"

<style>
    input::-webkit-calendar-picker-indicator {
        display: none;
    }
</style>

<EditForm Model="@myPerson">
    <InputDate class="form-control" @bind-Value="@myPerson.Birthday" />
</EditForm>

@code {
    Person myPerson = new Person();
    public class Person
    {
        public DateTime Birthday { get; set; } = DateTime.Now;
    }
}

Reference: Disable Native DatePicker

Jason D
  • 1,863
  • 2
  • 16
  • 30