Skip to content

How to masking money in filament 3 ? #9069

Answered by sinnbeck
jigujigu asked this question in Help
Discussion options

You must be logged in to vote

Sadly there is no Mask class anymore

https://filamentphp.com/docs/3.x/forms/fields/text-input#input-masking

But you could try copying it into your own project and see if it works still
https://github.com/filamentphp/forms/blob/2.x/src/Components/TextInput/Mask.php

Or you can use the new RawJs helper and just directly call the alpine money mask
https://alpinejs.dev/plugins/mask#money-inputs

TextInput::make('price')
      ->mask(RawJs::make(<<<'JS'
$money($input, '.', ',', 2)
JS
                    ))

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@jigujigu
Comment options

@luiseduardobraschi
Comment options

Answer selected by jigujigu
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
4 participants