Skip to content

Commit

Permalink
* button: support for setting text class to button.
Browse files Browse the repository at this point in the history
  • Loading branch information
catouse committed Sep 20, 2024
1 parent 0da4e7b commit 2d20f4f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/button/src/component/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ export class Button<P extends ButtonProps = ButtonProps> extends HElement<P> {
}

protected _getChildren(props: RenderableProps<P>) {
const {loading, loadingIcon, loadingText, icon, iconClass, text, children, trailingIcon, trailingIconClass, caret} = props;
const {loading, loadingIcon, loadingText, icon, iconClass, text, textClass, children, trailingIcon, trailingIconClass, caret} = props;
return [
loading ? <Icon icon={loadingIcon || 'icon-spinner-snake'} className="spin" /> : <Icon icon={icon} className={iconClass} />,
this._isEmptyText ? null : <span className="text">{loading ? loadingText : text}</span>,
this._isEmptyText ? null : <span className={classes('text', textClass)}>{loading ? loadingText : text}</span>,
loading ? null : children,
loading ? null : <Icon icon={trailingIcon} className={trailingIconClass} />,
loading ? null : caret ? <span className={typeof caret === 'string' ? `caret-${caret}` : 'caret'} /> : null,
Expand Down
1 change: 1 addition & 0 deletions lib/button/src/types/button-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface ButtonProps extends HElementProps {
icon?: IconType;
iconClass?: ClassNameLike;
text?: ComponentChildren;
textClass?: ClassNameLike;
square?: boolean;
trailingIcon?: IconType;
trailingIconClass?: ClassNameLike;
Expand Down

0 comments on commit 2d20f4f

Please sign in to comment.