Jakub Puszyński
Jakub Puszyński

Reputation: 31

Blazor and Bootstrap 5 Floating labels

Using Blazor I migrated to bootstrap 5 and want to use Floating labels with standard Blazor <InputNumber @bind-Value="FooModel.FooValue" />.

I'm trying combinations like:

<div class="form-floating">
    <InputNumber type="number" class="form-control" id="floatingInput" placeholder="[email protected]" @bind-Value="FooModel.FooValue" />
    <label for="floatingInput">Test blazor</label>
</div>

but it's not working. Any ideas?

EDIT-------------------

Ok, I founded my own bug - FooModel.FooValue was not nullable int type, so on View 0 was displayed as default;

Thanks anyway

Upvotes: 2

Views: 1563

Answers (2)

Jakub Puszyński
Jakub Puszyński

Reputation: 31

Ok, I founded my own bug - FooModel.FooValue was not nullable int type, so on View 0 was displayed as default;

Thanks anyway

Upvotes: 0

Mayur Ekbote
Mayur Ekbote

Reputation: 2080

It works. Which part of it is not working for you? Try @bind-Value="@FooModel.FooValue" instead of @bind-Value="FooModel.FooValue"

Assuming FooModel is the variable name and NOT class name.

Upvotes: 0

Related Questions