Link
A styled navigational hyperlink.
Installation
Included in poetry-ui — available as
poetry_link
the moment you've installed Poetry,
with no per-component step. To own the source and edit it, copy it into your app:
bin/rails g poetry:add link
Default
Current
Open Current standalone
<nav class="flex items-center gap-4 text-sm">
<%= poetry_link(href: "#", current: true) { "Dashboard" } %>
<%= poetry_link(href: "#") { "Projects" } %>
<%= poetry_link(href: "#") { "Settings" } %>
</nav>
External
Underline
Open Underline standalone
<div class="flex flex-wrap items-center gap-4">
<%= poetry_link(href: "#") { "Hover (default)" } %>
<%= poetry_link(href: "#", underline: :always) { "Always underlined" } %>
<%= poetry_link(href: "#", underline: :none) { "Never underlined" } %>
</div>
API
Poetry::Ui::Link::Component — options are
constructor keywords (the poetry_* helper forwards them);
slots are composed inside the block. Generated from the gem's source documentation.
| Option | Type | Details | Description |
|---|---|---|---|
| underline: | Symbol | one of: hover, always, none; defaults to :hover |
When the underline appears; :none suits links styled by their container. |
| current: | Boolean | defaults to false |
Marks this link as the current page via aria-current=page. |
| external: | Boolean | defaults to false |
Opens in a new tab with rel=\"noopener noreferrer\" - never hand-write target=_blank. |
| href: | String | required | The destination URL. |
Styling
Every part carries a stable data-slot attribute — target
[data-slot=…] from your own CSS to restyle it. State rides
data attributes on the parts below. This contract is verified against rendered DOM in CI.
| Part | Description |
|---|---|
| [data-slot=link] | The rendered <a> - the whole component; current: marks it aria-current=page |