Skip to content

feat(button): added possibility to set commandfor and command attributes #4408

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions packages/components/src/components/button/button.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export default function DBButton(props: DBButtonProps) {
value={props.value}
aria-describedby={props.describedbyid}
aria-expanded={props.ariaexpanded}
commandfor={props.commandfor}
command={props.command}
aria-pressed={props.ariapressed}>
<Show when={props.text} else={props.children}>
{props.text}
Expand Down
10 changes: 10 additions & 0 deletions packages/components/src/components/button/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ export type DBButtonDefaultProps = {
* Variant of the button. Use only 1 primary button on a page as CTA otherwise use one of the adaptive buttons.
*/
variant?: ButtonVariantType | string;

/**
* Either standardized or custom actions to be performed on an element that is being controlled by a control <button>, specified via the commandfor attribute. (https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/button#commandfor)
*/
commandfor?: string;

/**
* Turns a <button> HTML element into a command button, controlling the given interactive element; takes the ID of the element to control as its value. (https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/button#command)
*/
command?: string;
};

export type DBButtonProps = DBButtonDefaultProps &
Expand Down
Loading