Skip to content
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
1 change: 1 addition & 0 deletions guides/fields/readonly.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ On edit view, readonly is supported for:
- `Backpex.Fields.Number`
- `Backpex.Fields.Text`
- `Backpex.Fields.Textarea`
- `Backpex.Fields.Currency`

## Configuration

Expand Down
6 changes: 6 additions & 0 deletions lib/backpex/fields/currency.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ defmodule Backpex.Fields.Currency do
doc: "Timeout value (in milliseconds) or function that receives the assigns.",
type: {:or, [:pos_integer, {:fun, 1}]}
],
readonly: [
doc: "Sets the field to readonly. Also see the [panels](/guides/fields/readonly.md) guide.",
type: {:or, [:boolean, {:fun, 1}]}
],
unit: [
doc: "Unit to display with the currency value, e.g. '€'.",
type: :string,
Expand Down Expand Up @@ -107,6 +111,8 @@ defmodule Backpex.Fields.Currency do
unit={@field_options[:unit]}
unit_position={@field_options[:unit_position]}
symbol_space={@field_options[:symbol_space]}
readonly={@readonly}
disabled={@readonly}
aria-labelledby={Map.get(assigns, :aria_labelledby)}
/>
</Layout.field_container>
Expand Down