CTATButton - CMUCTAT/CTAT GitHub Wiki
A simple button component. This is the preferred button component and should be used in most cases as its underlying entity is a button which interacts better with assistive technology. If you require a more general clickable item, you can use CTATImageButton.
<div id="button" class="CTATButton">Click Me</div>-
id: Required. The name of the component, must be a valid html id name. -
class: Required. The class list, must includeCTATButtonand no other CTAT<component> classes. -
data-ctat-enabled:trueorfalse. Default istrue. Controls if the component will accept student interaction. -
data-ctat-tutor:trueorfalse. Default istrue. Controls if direct actions on the component trigger grading. -
data-ctat-show-feedback:trueorfalse. Default istrueunlessdata-ctat-tutor="false". Determines if grading feedback is shown on the component. -
data-ctat-show-hint-highlight:trueorfalse. Default istrue. Determines if hint highlighting is shown on the component. -
data-ctat-disable-on-correct:trueorfalse. Default istrue. Determines if the component becomes locked when it is graded as correct. -
value: A value to be used as the input of the SAI the button produces when it is clicked. Default is "-1". In most cases, you will not need to change this. It becomes useful when using the button in conjunction with a component that hasdata-ctat-ctrl-*attributes.
To add a label, insert text inside the <div>. In the example above, the label would be "Click Me". To make an image button, simply insert an <img> tag in the <div>, for example:
<div id="img_button" class="CTATButton"><img src="CTAT-icon.svg"/></div>In addition to the common Actions listed in Often Used TPAs this component supports the following actions:
| Action | Input | Notes |
|---|---|---|
| ButtonPressed | value (String) | The input value is "-1" unless the value attribute is set. |
| setText | value (String) | Sets the button label to the given value. |
.CTATButton { display: inline-block; } /* size based on the button's content */With no extra styling, this will use the <button> tag to generate a button. It will have the following classes added to it so you can override these classes to modify the look of the buttons. See the linked example for a demonstration.
.CTAT-button { /* For the generated <button> */
font:inherit;
width:inherit;
height:inherit;
}
.CTAT-button:hover {} /* when the mouse is hovering over the <button> */
.CTAT-button--clicked {} /* when the <button> is being clicked */
.CTAT-button:disabled {} /* when the <button> is disabled */Example for mass producing the button's label text:
<div id="button1" class="CTATButton">%(button1-text)%</div>Example for mass producing the button's image:
<div id="img_button" class="CTATButton"><img src="%(img_button-src)%"/></div>