Skip to content

IconButton ​

An icon-only button component.

Examples ​

Preact ​

jsx
const click = useCallback(() => alert("item added !"), []);

return (
  <IconButton onClick={click}>
    <Icon icon="increment" />
  </IconButton>
);

Vue.js x Custom Element ​

html
<script setup>
const click = () => alert("item added !");
</script>

<phi-icon-button @click="click">
  <phi-icon icon="increment" />
</phi-icon-button>

Vanilla JS x CSS ​

html
<button id="button" class="phi-icon-button">
  +
</button>

<script>
function onClick () {
  alert("item added !");
}
document.getElementById("button").addEventListener("click", onClick);
</script>

Color variants ​

default color ​

danger color ​

Suitable for buttons which users should be thoughtful before pressing.

Reference ​

Preact ​

Properties ​

PropertyTypeDefaultDescription
onClick() => voidemptyA handler function called on click
dangerbooleanfalseToggle danger color variant
childrenComponentChildrenemptyIcon elementent

Custom Element ​

Props / Attrs ​

SlotCategoryTypeDefault
dangerProp/Attrbooleanfalse

Events ​

Following events are confirmed to work as expected. Some other events may also work.

EventDescription
clickEmitted on user click

Pure-CSS ​

Classes ​

Class
phi-icon-buttonCore styles
dangerColor variants