Action

/libs/granite/ui/components/foundation/collection/action

Action is a component specializing to render foundation-collection-action. It will be rendered as a <button>.

It has the following content structure:

granite:CollectionAction
  1. granite:commonAttrs
  2. granite:renderCondition
targetstring

The selector to the .foundation-collection. This is optional and used when the component is placed outside the .foundation-collection.

activeCount
  1. 0
  2. >0

Show or hide the component according to how many .foundation-collection-item in the collection.

Values:

0
The property type is long. Show when there is no item at all; hide otherwise.
>0
The property type is string. Show when there is at least one item; hide otherwise.
activeSelectionCountstring
  1. none
  2. single
  3. multiple

Show or hide the component according to how many .foundation-selections-item in the collection.

Values:

none
Show when there is no selection at all; hide otherwise.
single
Show when there is exactly one selection; hide otherwise.
multiple
Show when there is one or more selections; hide otherwise.
actionstring

The action to be performed when the component is activated. If this property is not specified, no action will be performed.

commandstring

Command used as a shortcut for the action.

When ctrl or cmd is used, it will be normalized based on the client’s OS.

Grammar (ABNF)

command      ::=  key / sequence / modifier-cmd
key          ::=  valid-keyboard-key
sequence     ::=  key 1*("-" key)
modifier-cmd ::=  modifier *("+" modifier) "+" key
modifier     ::=  "ctrl" / "alt" / "meta" / "shift" / "cmd"

e.g. d, m, c, l-c, c-r, ctrl+c, alt+1, meta+t, shift+a, cmd+i

disabledboolean

true to disable the button; false otherwise.

textstring
i18n

The text of the button.

iconstring

The icon class.

iconSizestring
  1. S
  1. XS
  2. S
  3. M
  4. L

The size of the icon.

hideTextboolean

Visually hide the text.

variantstring
  1. primary
  2. warning
  3. quiet
  4. square
  5. large
  6. block
multiple

The variant of the button.

data

Indicates the data property of foundation-collection-action. It will be converted to JSON.

Its child nodes support property names with the following regex:

/(.+).uritemplate/

Indicate the value is a URITemplate. Context path is appended accordingly. It supports EL. The .uritemplate suffix is removed from the property name. Example:

+ data
  - href.uritemplate = "/action.html{+item}"  // will produce {"href" : "/ctx/action.html{+item}"}
/(.+).uritemplate.abs/

Indicate the value is a URITemplate that is resolved into an absolute path. Context path will be appended. It supports EL. The .uritemplate.abs suffix is removed from the property name. This scenario is important when you use the variable at the first char of the URITemplate, thus this component cannot know if the variable is going to be resolved as a relative path or absolute path. Example:

+ data
  - href.uritemplate.abs = "{+item}.html"  // will produce {"href" : "/ctx{+item}.html"}
/(.+).url/

Indicate the value is a URL. Context path is appended accordingly. It supports EL. The .url suffix is removed from the property name. Example:

+ data
  - href.url = "/action.html"  // will produce {"href" : "/ctx/action.html"}
/.+/

No processing is done. The value is passed as is. Example:

+ data
  - href = "/action.html"  // will produce {"href" : "/action.html"}
  - int = 123  // will produce {"int" : 123}