fwt/src/builtin-components/Button/Button.tsx
2025-08-26 11:54:05 +08:00

23 lines
No EOL
492 B
TypeScript

import './Button.sass'
import { Show } from 'solid-js'
interface Props {
label?: string;
to?: string;
onClick?: () => void;
}
export default (props: Props) => {
return
<>
<Show when={props.to}>
<a href={props.to} aria-label={props.label}>
<button class="button">{props.label || 'Click Me!'}</button>
</a>
</Show>
<Show when={!props.to}>
<button class="button" onClick={props.onClick}>{props.label || 'Click Me!'}</button>
</Show>
</>
}