-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:avo-hq/docs.avohq.io
- Loading branch information
Showing
8 changed files
with
119 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
--- | ||
version: '3.15.0' | ||
license: community | ||
--- | ||
|
||
# Radio | ||
|
||
<Image src="/assets/img/fields/radio.png" width="425" height="87" alt="Radio field" /> | ||
|
||
The `Radio` field is used to render radio buttons. It's useful when only one value can be selected in a given options group. | ||
|
||
### Field declaration example | ||
Below is an example of declaring a `radio` field for a role: | ||
|
||
```ruby | ||
field :role, | ||
as: :radio, | ||
name: "User role", | ||
options: { | ||
admin: "Administrator", | ||
manager: "Manager", | ||
writer: "Writer" | ||
} | ||
``` | ||
|
||
<Option name="`options`"> | ||
|
||
The `options` attribute accepts either a `Hash` or a proc, allowing the incorporation of custom logic. Within this block, you gain access to all attributes of [`Avo::ExecutionContext`](../execution-context) along with the `record`, `resource`, `view` and `field`. | ||
|
||
This attribute represents the options that should be displayed in the radio buttons. | ||
|
||
#### Default value | ||
|
||
Empty `Hash`. | ||
|
||
```ruby | ||
{} | ||
``` | ||
|
||
#### Possible values | ||
|
||
Any `Hash`. The keys represent the value that will be persisted and the values are the visible labels. Example: | ||
|
||
```ruby | ||
options: { | ||
admin: "Administrator", | ||
manager: "Manager", | ||
writer: "Writer" | ||
} | ||
``` | ||
|
||
Or a `Proc`: | ||
|
||
```ruby | ||
options: -> do | ||
record.roles.each_with_object({}) do |role, hash| | ||
hash[role.id] = role.name.humanize | ||
end | ||
end | ||
``` | ||
|
||
</Option> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+266 KB
docs/public/assets/img/customization/associations-lookup-list-limit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.