diff --git a/packages/reacord/library.new/core/button-shared-props.ts b/packages/reacord/library.new/core/button-shared-props.ts index 4218af1..4ba558f 100644 --- a/packages/reacord/library.new/core/button-shared-props.ts +++ b/packages/reacord/library.new/core/button-shared-props.ts @@ -8,6 +8,11 @@ export type ButtonSharedProps = { /** The text on the button. Rich formatting (markdown) is not supported here. */ label?: ReactNode + /** The text on the button. Rich formatting (markdown) is not supported here. + * If both `label` and `children` are passed, `children` will be ignored. + */ + children?: ReactNode + /** When true, the button will be slightly faded, and cannot be clicked. */ disabled?: boolean diff --git a/packages/reacord/library.new/core/button.tsx b/packages/reacord/library.new/core/button.tsx index 27b5434..bc3957b 100644 --- a/packages/reacord/library.new/core/button.tsx +++ b/packages/reacord/library.new/core/button.tsx @@ -1,6 +1,5 @@ import { randomUUID } from "node:crypto" import React from "react" -import type { Except } from "type-fest" import type { ButtonSharedProps } from "./button-shared-props" import type { ComponentEvent } from "./component-event" import { Node } from "./node" @@ -27,18 +26,18 @@ export type ButtonProps = ButtonSharedProps & { */ export type ButtonClickEvent = ComponentEvent -export function Button({ label, ...props }: ButtonProps) { +export function Button({ label, children, ...props }: ButtonProps) { return ( new ButtonNode(props)} nodeProps={props} > - {label} + {label ?? children} ) } -export class ButtonNode extends Node> { +export class ButtonNode extends Node { readonly customId = randomUUID() }