Skip to content

TextButton

An in-text button component, that looks like links.

Examples

Please 👆 Click me

Preact

jsx
const click = useCallback(() => alert("you did it !", []));

return (
  Please <TextButton onClick={click}>
    👆 Click me
  </TextButton>
);

Vue.js x Custom Element

html
<script setup>
const click = () => alert("you did it !");
</script>

Please <phi-text-button @click="click">
  👆 Click me
</phi-text-button>

Vanilla JS x CSS

html
Please <button id="button" class="phi-text-button">
  👆 Click me
</button>

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

Color variants

default color

Please 👆 Click me

danger color

Suitable for buttons which users should be thoughtful before pressing.

You probably should not 💀 Click this

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

Class
phi-text-buttonCore styles
dangerColor variants