Button
Este conteúdo não está disponível em sua língua ainda.
Variant
Section titled “Variant”Use the variant
prop to change the visual style of the Button.
<script lang="ts"> import { Constants } from "@fefade/core" import { Button } from "@fefade/svelte"</script>
<div style=" display: flex; flex-wrap: wrap; gap: 1rem; "> {#each Constants.variants as variant (variant)} <Button {variant}>{variant}</Button> {/each}</div>
Use the class
or style
prop to change the color of the button.
<script lang="ts"> import { Constants } from "@fefade/core" import { Button } from "@fefade/svelte"</script>
<div style="display:flex; align-items: baseline; gap: 1rem; flex-wrap: wrap;"> {#each Constants.statusColors as color (color)} <Button class="bg-{color} text-on-{color}"> {color} </Button> {/each} <Button style="background: aqua;">aqua</Button></div>
Use the size
prop to change the size of the button.
<script lang="ts"> import { Constants } from "@fefade/core" import { Button } from "@fefade/svelte"</script>
<div style="display:flex; align-items: baseline; gap: 1rem; flex-wrap: wrap;"> {#each Constants.sizes as size (size)} <Button {size}>{size}</Button> {/each}</div>
Loading
Section titled “Loading”Pass the isLoading
props to the Button component to show a loading spinner.
<script lang="ts"> import { Button } from "@fefade/svelte"</script>
<Button isLoading disabled></Button><Button isLoading></Button>
Use icons within a button.
<script lang="ts"> import { Button } from "@fefade/svelte"</script>
<Button> <svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 -960 960 960" width="16px" fill="red" > <path d="m480-120-58-52q-101-91-167-157T150-447.5Q111-500 95.5-544T80-634q0-94 63-157t157-63q52 0 99 22t81 62q34-40 81-62t99-22q94 0 157 63t63 157q0 46-15.5 90T810-447.5Q771-395 705-329T538-172l-58 52Z" /> </svg> heart</Button>
Use the href
and target
optional prop to render a button as a link.
<script lang="ts"> import { Button } from "@fefade/svelte"</script>
<Button href="https://github.com/dxdns" target="_blank">Link</Button>
Disabled
Section titled “Disabled”Use the disabled
prop to disable the button.
<script lang="ts"> import { Button } from "@fefade/svelte"</script>
<Button disabled>Disabled</Button>
Pressed effect
Section titled “Pressed effect”Press effect is enabled by default. Use the pressedEffect
prop to disable
pressed effect the button.
<script lang="ts"> import { Button } from "@fefade/svelte"</script>
<Button pressedEffect={false}>No pressed effect</Button><Button>Pressed effect</Button>