Skip to content

Commit

Permalink
icon override steps
Browse files Browse the repository at this point in the history
  • Loading branch information
ShashiSubramanya committed Feb 5, 2025
1 parent b878362 commit fb7cbb4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
34 changes: 30 additions & 4 deletions modules/ROOT/pages/customize-icons.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ You can customize the icons on a ThoughtSpot page using an icon sprite SVG file
.. On your ThoughtSpot instance, right-click on the icon and select *Inspect*.
.. Inspect the `<svg>` element.
.. Note the icon ID.

* Add the SVG hosting domain to the following allowlists on the *Develop* > *Security Settings* page:
** xref:security-settings.adoc#csp-connect-src[CSP connect-src domains allowlist]
** xref:security-settings.adoc#csp-trusted-domain[CSP img-src domains allowlist]
Expand Down Expand Up @@ -60,9 +61,35 @@ You can add the `fill` property to the `<symbol>` tag to define a different fill
== Override an icon
To override an icon:

. Create an icon sprite file with the SVG element, define the properties, and specify the icon ID.
. Ensure that you have the icon ID of the icon you want to replace.
+
The following figure illustrates how to locate the Spotter icon ID in the embed Playground:
+
[.widthAuto]
[.bordered]
image::./images/locate-icon-customization.png[Locate icon ID]

. To replace the icon with an SVG, open the icon in a web browser, click **Inspect**, and then copy the SVG code.
. Create an icon sprite file with the SVG code.
. In the `<symbol>` element, specify ID of the icon you want to replace. For example, `rd-icon-spotter`.
. Modify the xref:#_viewbox_property[viewBox] and xref:_fill_property[fill] properties as required.
+
Th following code snippet shows an example of the SVG code for the icon sprite that overrides the Spotter icon:
+
[source,HTML]
----
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="width:0;height:0;visibility:hidden;">
<defs/>
<symbol id="rd-icon-spotter" viewBox="0 0 48 48" fill="black">
<path xmlns="http://www.w3.org/2000/svg" d="M45.6,18.7,41,14.9V7.5a1,1,0,0,0-.6-.9L30.5,2.1h-.4l-.6.2L24,5.9,18.5,2.2,17.9,2h-.4L7.6,6.6a1,1,0,0,0-.6.9v7.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v5.2l3.4,3.5a1.7,1.7,0,0,0,2.2,0,1.8,1.8,0,0,0,0-2.2l-2.6-2.5V30.6l4-4V21.4l-4-4Z"/>
</symbol>
</svg>
----

+
The following code snippet shows how to override the chart icon (`rd-icon-chart`) on the *Answers* page.
The following example overrides the chart icon (`rd-icon-chart`) on the *Answers* page.
+
[source,HTML]
----
Expand All @@ -75,9 +102,8 @@ The following code snippet shows how to override the chart icon (`rd-icon-chart
</symbol>
</svg>
----
+

To override multiple icons, use the following format:
. To override multiple icons at once, you can use the following format:
+
[source,HTML]
----
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fb7cbb4

Please sign in to comment.