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

Add documentation for Money component #25

Open
wants to merge 1 commit into
base: 0.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
63 changes: 63 additions & 0 deletions money.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Money

The `money` component is a conveniant way to handle presenting monetary values in your application. You can consider it a thin, Blade-specific wrapper around [Laravel's `Number::currency` helper](https://laravel.com/docs/11.x/helpers#method-number-currency).

## Installation

The `money` component comes ready out-of-the-box with Blade UI Kit. Simply [install the package](/docs/{{version}}/installation) and you're good to go.

## Basic usage

In order to render a monetary value, just wrap the raw value in the `money` component:

```
<x-money>150</x-money>
```

This will output the following HTML:

```
<span>$150.00</span>
```

## Currency

You can customize the currency that is used to render the value via the `currency` property.

```
<x-money currency="EUR">149.99</x-money>
```

This will output the following HTML:

```
<span>€149.99</span>
```

## Locale

By default, the `money` component renders the monetary value using the locale you've specified in your `app.locale` configuration option. If you wish to render the value in a different locale, you can use the `locale` property.

```
<x-money locale="nl">150</x-money>
```

This will output the following HTML:

```
<span>US$ 150,00</span>
```

## Combining properties

Of course, the `currency` and `locale` properties can be used in conjunction:

```
<x-money currency="SEK" locale="sv">150</x-money>
```

This will output the following HTML:

```
<span>150,00 kr</span>
```
1 change: 1 addition & 0 deletions toc.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
"pages": [
"avatar",
"cron",
"money",
"unsplash"
]
}
Expand Down