Skip to content

Commit 8361fff

Browse files
committed
update the docs
1 parent 69f9c9c commit 8361fff

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

preview-src/asciidoc/images.adoc

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,10 @@ Use the custom `svg` macro to define an SVG image that uses CSS variables to sup
6969
[source,asciidoc]
7070
----
7171
svg::ROOT:illustration.svg[alt="Alt text",width=400]
72+
svg::ROOT:illustration.svg[Alt text,400,275]
7273
----
7374
74-
The `svg` macro supports the following attributes: `width`, `height`, `role`, `alt`, and `title`.
75+
The `svg` macro supports the following attributes: `width`, `height`, `role`, `alt`, `ariaLabel` and `title`.
7576
7677
[IMPORTANT]
7778
====
@@ -114,25 +115,35 @@ Click icon:settings[name="Settings"] to configure your settings. // <.>
114115
115116
icon:moon[alt="That's no moon"] // <.>
116117
118+
icon:sun[ariaLabel="Day time"] // <.>
119+
117120
icon:atom[title="Split the atom"] // <.>
118121
119-
icon:star[role="text-amber-600 text-2xl"] // <.>
122+
icon:star[role="text-failure text-2xl"] // <.>
120123
121124
icon:star[size="60"] // <.>
125+
126+
icon:star[60] // <.>
122127
----
123128
<.> Use the `name` attribute to add visible text to the right of the icon.
124129
125130
<.> Use the `alt` attribute to define an `aria-label` label for the icon.
126131
The text is invisible but is read by screen readers.
127-
_Do not use `alt` if `name` or `title` is already defined._
132+
_Do not use `alt` if `name` is already defined._
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._
128136
129-
<.> The `title` attribute does the same thing as `alt`, except the text is also visible as a tooltip on hover.
130-
_Do not use `title` if `name` or `alt` is already defined._
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._
131140
132141
<.> Use the `role` attribute to apply Tailwind CSS classes to the icon.
133142
134143
<.> Use the `size` attribute to define the icon size in pixels.
135144
145+
<.> Use the first positional attribute to define the icon size in pixels. This is shorthand for the `size` attribute.
146+
136147
You can invoke a Material icon with `\icon:material:icon-name[]`.
137148
All of the same attributes apply:
138149
@@ -145,7 +156,7 @@ icon:material:air[alt="Whooosh"]
145156
146157
icon:material:volume-up[title="Turn it up"]
147158
148-
icon:material:directions-boat[role="text-amber-600 text-2xl"]
159+
icon:material:directions-boat[role="text-warning text-2xl"]
149160
150161
icon:material:thumb-up[size=60]
151162
----
@@ -215,7 +226,7 @@ Inline lucide icons +++<i class="icon-boom-box"></i>+++
215226
// +
216227
// icon:atom[title="Split the atom"]
217228
// +
218-
// icon:star[role="text-amber-600 text-2xl"]
229+
// icon:star[role="text-warning text-2xl"]
219230
// +
220231
// icon:star[size="60"]
221232

@@ -227,7 +238,7 @@ Inline lucide icons +++<i class="icon-boom-box"></i>+++
227238
// +
228239
// icon:material:volume-up[title="Turn it up"]
229240
// +
230-
// icon:material:directions-boat[role="text-amber-600 text-2xl"]
241+
// icon:material:directions-boat[role="text-failure text-2xl"]
231242
// +
232243
// icon:material:thumb-up[size=60]
233244

@@ -244,18 +255,22 @@ svg:ROOT:ui/icons/vector.svg[role="icon"] // <.>
244255
svg:ROOT:ui/icons/vector.svg[role="icon text-2xl"] // <.>
245256
246257
Click svg:ROOT:ui/icons/vector.svg[role="icon text-2xl"] *Search* to run a similarity search based on the selected document's vector.
258+
259+
svg:ROOT:ui/icons/vector.svg[width="60",height="60"] // <.>
247260
----
248261
249262
<.> The `icon` role adds CSS styles that pin the width and height of the image to the font size of the parent element.
250263
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).
251264
252-
<.> Setting the `icon` role by itself usually leads to the icon appearing too small.
253-
You can control the size of the icon with Tailwind `text-*` utilities, with `text-2xl` being the ideal size when the icon is used within body text.
265+
<.> You can control the size of the icon with Tailwind `text-*` utilities, such as `text-2xl` to enlarge the icon.
266+
267+
<.> You can also set the width and height of the svg directly.
254268
255269
[IMPORTANT]
256270
====
257271
Unlike <<font-icons,font icons>>, the `svg` macro doesn't automatically support light and dark mode.
258272
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.
259274
====
260275
======
261276

0 commit comments

Comments
 (0)