|
15 | 15 | <x-section title="Concept" disable-copy> |
16 | 16 | The currency component is a component designed for displaying and formatting |
17 | 17 | currency values. Behind the scenes the currency component is an adaptation of |
18 | | - the Input component with usage of native JavaScript's <x-block>Intl.NumberFormat</x-block> |
| 18 | + the <x-block>input</x-block> component with usage of native JavaScript's <x-block>Intl.NumberFormat</x-block> |
19 | 19 | </x-section> |
20 | 20 | <x-section title="Basic Usage"> |
21 | 21 | <x-preview language="blade" :contents="$basic"> |
|
35 | 35 | <x-section title="Different Currencies"> |
36 | 36 | <div class="space-y-4"> |
37 | 37 | <p> |
38 | | - The currency component has a <x-block>locale</x-block> attribute that matches the logic of |
| 38 | + You should use the <x-block>locale</x-block> attribute to matches the logic of |
39 | 39 | <x-block>Intl.NumberFormat</x-block>. By default, the value assigned to the locale attribute |
40 | 40 | is <x-block>en-US</x-block>, but you can use any other value supported by <x-block>Intl.NumberFormat</x-block> |
41 | 41 | to format the input in the desired currency format. |
|
52 | 52 | <x-section title="Intl Options" disable-copy> |
53 | 53 | <div class="space-y-4"> |
54 | 54 | <p> |
55 | | - The currency component was built with two attributes that are intended to manipulate the JavaScript <x-block>Intl.NumberFormat</x-block>, |
| 55 | + The component was built with two attributes that are intended to manipulate the JavaScript <x-block>Intl.NumberFormat</x-block>, |
56 | 56 | called <x-block>decimals</x-block> and <x-block>precision</x-block>. You can use them to manipulate the |
57 | 57 | JavaScript <x-block>Intl.NumberFormat</x-block>: |
58 | 58 | </p> |
|
62 | 62 | <x-section title="Symbols"> |
63 | 63 | <div class="space-y-4"> |
64 | 64 | <p> |
65 | | - The currency component supports displaying symbols related to each supported |
| 65 | + You can display symbols related to each supported |
66 | 66 | currency through <a href="{{ route('documentation', ['v2', 'translation']) }}" class="underline">TallStackUI's translation system.</a> You can control which symbol |
67 | 67 | will be displayed via arguments. |
68 | 68 | </p> |
|
89 | 89 | <x-section title="Caveats"> |
90 | 90 | <div class="space-y-4"> |
91 | 91 | <p> |
92 | | - There are a few important things to note about the currency component. The first is that the component |
93 | | - can be used entirely out of the Livewire context. For this type of situation, the value to be formatted |
94 | | - should be sent to the currency component using the <x-block>value</x-block> attribute, but with the value as a string. |
95 | | - The value will be returned to the controller formatted as a string, when the form is submitted. |
96 | | - When the component is used inside the Livewire context, however, the value can be sent in different |
97 | | - formats <i>(float, int, string)</i>, but the value returned by default will not be formatted. To format the |
98 | | - value when emitting it to the Livewire, you must use the <x-block>mutate</x-block> attribute, which |
99 | | - instructs the currency component to format the value before binding it to the Livewire property. |
| 92 | + There are a few important caveats to note about the currency component: |
100 | 93 | </p> |
| 94 | + <ul class="list-inside list-decimal space-y-2"> |
| 95 | + <li> |
| 96 | + The component |
| 97 | + can be used entirely out of the Livewire context. For this type of situation, the value to be formatted |
| 98 | + should be sent to the currency component using the <x-block>value</x-block> attribute, but with the value as a string. |
| 99 | + The value will be returned to the controller formatted as a string, when the form is submitted. |
| 100 | + </li> |
| 101 | + <li> |
| 102 | + When using the component inside the Livewire context, however, the value can be sent to the component in different |
| 103 | + formats <i>(float, int, string)</i>, but the value returned by default will not be formatted. To format the |
| 104 | + value when emitting it to the Livewire, you must use the <x-block>mutate</x-block> attribute, which |
| 105 | + instructs the currency component to format the value before binding it to the Livewire property. |
| 106 | + </li> |
| 107 | + </ul> |
101 | 108 | <x-preview language="blade" :contents="$mutate"> |
102 | 109 | <div class="space-y-2"> |
103 | 110 | <livewire:documentation.form.currency /> |
|
0 commit comments