crowd-button
A styled button that represents some action.
See an interactive example of an HTML template that uses this Crowd HTML Element in CodePen
The following is an example of a template that uses the <crowd-button>
element. Copy the following code and save it in a file with the extension .html
.
Open the file in any browser to preview and interact with this template.
<script src="https://assets.crowd.aws/crowd-html-elements.js"></script> <crowd-form> <crowd-image-classifier name="crowd-image-classifier" src="https://unsplash.com/photos/NLUkAA-nDdE" header="Please select the correct category for this image" categories="['Person', 'Umbrella', 'Chair', 'Dolphin']" > <full-instructions header="Classification Instructions"> <p>Read the task carefully and inspect the image.</p> <p>Choose the appropriate label that best suits the image.</p> </full-instructions> <short-instructions> <p>Read the task carefully and inspect the image.</p> <p>Choose the appropriate label that best suits the image.</p> <crowd-button> <iron-icon icon="question-answer"/> </crowd-button> </short-instructions> </crowd-image-classifier> </crowd-form>
Attributes
The following attributes are supported by this element.
disabled
A Boolean switch that, if present, displays the button as disabled and prevents clicks.
form-action
A switch that either submits its parent crowd-form element, if set to "submit", or resets its parent <crowd-form> element, if set to "reset".
href
The URL to an online resource. Use this property if you need a link styled as a button.
icon
A string that specifies the icon to be displayed next to the button's text. The string must
be the name of an icon from the open-source iron-icons
<crowd-button> <iron-icon icon="search"/> </crowd-button>
The icon is positioned to either the left or the right of the text, as specified by the icon-align attribute.
To use a custom icon see icon-url.
icon-align
The left or right position of the icon relative to the button's text. The default is "left".
icon-url
A URL to a custom image for the icon. A custom image can be used in place of a standard icon that is specified by the icon attribute.
loading
A Boolean switch that, if present, displays the button as being in a loading state. This attribute has precedence over the disabled attribute if both attributes are present.
target
When you use the href
attribute to make the button act as a hyperlink to a specific URL, the target
attribute optionally targets a frame or window where the linked URL should load.
variant
The general style of the button. Use "primary" for primary buttons, "normal" for secondary buttons, "link" for tertiary buttons, or "icon" to display only the icon without text.
Element Hierarchy
This element has the following parent and child elements.
-
Parent elements: crowd-form
-
Child elements: none
See Also
For more information, see the following.