Skip to content
This repository has been archived by the owner on Feb 10, 2024. It is now read-only.

Add button title attribute #24

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions components/button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2022. Heusala Group Oy <info@heusalagroup.fi>. All rights reserved.
// Copyright (c) 2023. Heusala Group Oy <info@heusalagroup.fi>. All rights reserved.
eXtranium marked this conversation as resolved.
Show resolved Hide resolved
// Copyright (c) 2021. Sendanor <info@sendanor.fi>. All rights reserved.

import {
Expand Down Expand Up @@ -29,6 +29,7 @@ export interface ButtonProps {
readonly style ?: ButtonStyle;
readonly enabled?: boolean;
readonly children?: ReactNode;
readonly title?: string;
}

export type ButtonClickCallback = VoidCallback;
Expand All @@ -47,7 +48,8 @@ export function Button (props: ButtonProps) {
onKeyDown?: any,
ref?: any,
disabled?: any,
onClick?: any
onClick?: any,
title?: string
} = {};

const blurCallback = props?.blur;
Expand Down Expand Up @@ -75,6 +77,11 @@ export function Button (props: ButtonProps) {
buttonProps.disabled = true;
}

const title = props?.title;
if (title) {
buttonProps.title = title;
}

const onClick = useCallback(
(event: MouseEvent<HTMLButtonElement>) => {

Expand Down