docs: make 2.x the default version (#3369)
This commit is contained in:
@@ -11,13 +11,13 @@ current page within a set of pages.
|
||||
- `aria-current="page"` - Added to links with an exact path match, enhancing
|
||||
accessibility by indicating the current page to assistive technologies.
|
||||
|
||||
As we aim to improve accessibility, we encourage the use of `aria-current` for
|
||||
As we aim to improve accessibility, we encourage the use of aria-current for
|
||||
styling current links where applicable.
|
||||
|
||||
## Styling with CSS
|
||||
|
||||
The `aria-current` attribute is easily styled with CSS using attribute
|
||||
selectors, providing a native way to visually differentiate the active link.
|
||||
The aria-current attribute is easily styled with CSS using attribute selectors,
|
||||
providing a native way to visually differentiate the active link.
|
||||
|
||||
```css static/styles.css
|
||||
/* Give links pointing to the current page a green color */
|
||||
@@ -31,14 +31,13 @@ a[aria-current="true"] {
|
||||
}
|
||||
```
|
||||
|
||||
## Tailwind / Twind
|
||||
## Tailwindcss
|
||||
|
||||
In Tailwind or similar CSS frameworks like Twind, you can apply styles to
|
||||
elements with the aria-current attribute using bracket notation in your class
|
||||
definitions. However, the specific syntax varies slightly between Tailwind and
|
||||
Twind. For Tailwind, use the syntax:
|
||||
In Tailwindcss or similar CSS frameworks, you can apply styles to elements with
|
||||
the `aria-current` attribute using bracket notation in your class definitions.
|
||||
For Tailwindcss, use the syntax:
|
||||
|
||||
```tsx component/Menu.tsx
|
||||
```tsx components/Menu.tsx
|
||||
function Menu() {
|
||||
return (
|
||||
<a href="/foo" class="aria-[current]:text-green-600">
|
||||
@@ -47,33 +46,3 @@ function Menu() {
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
For Twind, the syntax is:
|
||||
|
||||
```tsx component/Menu.tsx
|
||||
function Menu() {
|
||||
return (
|
||||
<a href="/foo" class="[aria-current]:text-green-600">
|
||||
Link to some page
|
||||
</a>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
### Twind Plugin
|
||||
|
||||
The original twind plugin (`import twindPlugin from "$fresh/plugins/twind.ts";`)
|
||||
supports the above style:
|
||||
|
||||
```tsx routes/page.tsx
|
||||
class="[aria-current='page']:text-green-600"
|
||||
```
|
||||
|
||||
### TwindV1 Plugin
|
||||
|
||||
The new twind plugin (`import twindPlugin from "$fresh/plugins/twindv1.ts";`)
|
||||
requires a slightly different syntax (note the position of the left bracket):
|
||||
|
||||
```tsx routes/page.tsx
|
||||
class="aria-[current='page']:text-green-600"
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user