You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: preview-src/asciidoc/images.adoc
+27-24Lines changed: 27 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -106,7 +106,7 @@ Use the `icon` macro to invoke font icons from https://lucide.dev/icons/[Lucide
106
106
The `icon` macro follows https://developers.google.com/style/ui-elements#buttons[accessibility standards] and provides built-in support for light and dark mode.
107
107
108
108
Lucide is the default icon set.
109
-
You can invoke a Lucide icon with either `\icon:icon-name[]` or `\icon:lucide:icon-name[]`:
109
+
You can invoke a Lucide icon with either `\icon:ICON-NAME[]` or `\icon:lucide:ICON-NAME[]`:
110
110
111
111
.Lucide
112
112
[source,asciidoc]
@@ -121,28 +121,29 @@ icon:atom[title="Split the atom"] // <.>
121
121
122
122
icon:star[role="text-failure text-2xl"] // <.>
123
123
124
-
icon:star[size="60"] // <.>
125
-
126
-
icon:star[60] // <.>
124
+
icon:star[size="60"] or icon:star[60] // <.>
127
125
----
126
+
128
127
<.> Use the `name` attribute to add visible text to the right of the icon.
129
128
130
-
<.> Use the `alt` attribute to define an `aria-label` label for the icon.
129
+
<.> Use the `alt` attribute to define an `aria-label` for the icon.
131
130
The text is invisible but is read by screen readers.
132
-
_Do not use `alt` if `name` is already defined._
131
+
+
132
+
_Do not use `alt` if `name` or `ariaLabel` is already defined._
133
133
134
-
<.> Use the `ariaLabel` attribute to define an `aria-label` label for the icon. This is the same as `alt`.
135
-
_Do not use `ariaLabel` if `name` is already defined._
134
+
<.> Identical to the `alt` attribute.
135
+
+
136
+
_Do not use `ariaLabel` if `name` or `alt` is already defined._
136
137
137
-
<.> The `title` attribute provides a visible tooltip on hover for pointer devices.
138
-
_The `title` attribute is not read by most screen readers. Use `alt` or `ariaLabel` for accessibility._
139
-
_The tooltip is not visible on touch devices._
138
+
<.> The `title` attribute provides a visible tooltip on hover for pointer devices (not visible on touch devices).
139
+
+
140
+
_The `title` attribute is not read by most screen readers, and therefore its use is discouraged._
141
+
_If used, make sure to also define `alt` or `ariaLabel` to ensure accessibility._
140
142
141
143
<.> Use the `role` attribute to apply Tailwind CSS classes to the icon.
142
144
143
-
<.> Use the `size` attribute to define the icon size in pixels.
144
-
145
-
<.> Use the first positional attribute to define the icon size in pixels. This is shorthand for the `size` attribute.
145
+
<.> Use the `size` attribute to define the size of the icon in pixels.
146
+
Alternatively, you can define the size in the first https://docs.asciidoctor.org/asciidoc/latest/attributes/positional-and-named-attributes/#positional[positional attribute] (shorthand for the `size` attribute).
146
147
147
148
You can invoke a Material icon with `\icon:material:icon-name[]`.
148
149
All of the same attributes apply:
@@ -195,7 +196,7 @@ Inline material icons [.material-icons]#thumb_up#
195
196
HTML passthrough::
196
197
+
197
198
--
198
-
Use block or inline HTML passthrough to create an icon element `<i class="icon-{icon-name}"></i>`.
199
+
Use block or inline HTML passthrough to create an icon element `<i class="icon-ICON-NAME"></i>`.
199
200
200
201
This method supports light and dark mode automatically.
<.> The `icon` role adds CSS styles that pin the width and height of the image to the font size of the parent element.
263
+
<.> The `icon` role adds CSS styles that set the width and height of the image to an appropriate size relative to the font size of the parent element.
263
264
Without the `icon` role, the image displays as large as possible unless a width and height is set in the SVG file itself (not recommended).
264
265
265
-
<.> You can control the size of the icon with Tailwind `text-*` utilities, such as `text-2xl` to enlarge the icon.
266
+
<.> Manually control the icon size using Tailwind `text-*` utilities, such as `text-2xl`.
266
267
267
-
<.> You can also set the width and height of the svg directly.
268
+
<.> Manually control the icon size using the `width` and `height` attributes.
268
269
269
270
[IMPORTANT]
270
271
====
271
272
Unlike <<font-icons,font icons>>, the `svg` macro doesn't automatically support light and dark mode.
272
273
You'll need to add supported <<svg-images-css,CSS variables>> to the SVG file for the icon to display properly in light and dark mode.
273
-
If the svg is a simple, single-color icon, you can use `currentColor` for all fill and stroke colors. This will automatically inherit the text color of the parent element or the body text color which is black or white depending on the theme.
274
+
275
+
If the svg is a simple, single-color icon, you can use `currentColor` for all fill and stroke colors.
276
+
This will automatically inherit the text color of the parent element or the body text color which is black or white depending on the theme.
274
277
====
275
278
======
276
279
277
-
// Click svg:ROOT:ui/icons/vector.svg[role="icon text-2xl"] *Search* to run a similarity search based on the selected document's vector.
280
+
// Click svg:ROOT:ui/icons/vector.svg[role="icon"] *Search* to run a similarity search based on the selected document's vector.
0 commit comments