db-ui / mono

DB UX Design System Monorepo - Provides Design Tokens and components for Web UIs
https://db-ui.github.io/mono/review/main/
Apache License 2.0
21 stars 6 forks source link

Enable different tags for components #2481

Open nmerget opened 3 weeks ago

nmerget commented 3 weeks ago
          I think your suggestion could be useful when using the pure HTML version. In my opinion, mentioned components should support router links to provide consistent and convenient usage.

For example, offer the possibility via optional prop to render DBButton and DBLink with a neutral tag. Then a nested anchor tag would be valid again.

Spontaneous suggestion for React:

<DBButton tag="div" variant="brand">
    <Link to={link.path}>
        {link.label}
    </Link>
</DBButton>

Renders to:

<div class="db-button" data-variant="brand">
    <a href="/foo/bar">Foo Bar</a>
</div>

This is just a suggestion, I don't know all the previous discussions on this. :)

_Originally posted by @bruno-sch in https://github.com/db-ui/mono/pull/2378#discussion_r1535168194_

nmerget commented 3 weeks ago

A big issue is Angular, where we might need directives for this to be achieved. Maybe we can look at https://stackoverflow.com/a/44699654 to solve the issue inside the component without a separate directive.