MCPcopy Create free account
hub / github.com/arctic-cli/interface / showToast

Function showToast

packages/ui/src/components/toast.tsx:106–133  ·  view source on GitHub ↗
(options: ToastOptions | string)

Source from the content-addressed store, hash-verified

104}
105
106export function showToast(options: ToastOptions | string) {
107 const opts = typeof options === "string" ? { description: options } : options
108 return toaster.show((props) => (
109 <Toast toastId={props.toastId} duration={opts.duration} data-variant={opts.variant ?? "default"}>
110 <Show when={opts.icon}>
111 <Toast.Icon name={opts.icon!} />
112 </Show>
113 <Toast.Content>
114 <Show when={opts.title}>
115 <Toast.Title>{opts.title}</Toast.Title>
116 </Show>
117 <Show when={opts.description}>
118 <Toast.Description>{opts.description}</Toast.Description>
119 </Show>
120 <Show when={opts.actions?.length}>
121 <Toast.Actions>
122 {opts.actions!.map((action) => (
123 <button data-slot="toast-action" onClick={action.onClick}>
124 {action.label}
125 </button>
126 ))}
127 </Toast.Actions>
128 </Show>
129 </Toast.Content>
130 <Toast.CloseButton />
131 </Toast>
132 ))
133}
134
135export interface ToastPromiseOptions<T, U = unknown> {
136 loading?: JSX.Element

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected