Sara UI

logo

showNotification

Allows to show a notification.

Def:

(cause: "success" | "info" | "warning" | "error", content: string, title?: string) => void

Example

Example.svelte
<script>
  import { showNotification, Button } from "saraui"

  function handleClick() {
    showNotification("success", "Hello, world! 👋🏼")
  }
</script>

<Button onClick={handleClick}>
  Show notification
</Button>

updateTheme

Allows to update the theme.

It'll be automatically saved in the localStorage and loaded everytime SaraProvider is mounted.

You can only select the themes that you added previously in the Tailwind's config file.

Learn more about themes

Def:

(string) => void

Example

Example.svelte
<script>
  import { Button, updateTheme } from "saraui"
</script>

<Button onClick={() => udpateTheme("dracula")}>
  Set dark mode
</Button>