Skip to content

Commit bfb1bf6

Browse files
authored
Merge pull request #866 from ReactTooltip/tooltip-opacity-var
feat: add opacity css variable
2 parents c833dfe + 7f6ed4c commit bfb1bf6

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

docs/docs/getting-started.mdx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,20 @@ import { Tooltip } from 'react-tooltip'
9898

9999
### Styling
100100

101-
If you want a styled tooltip, don't forget to add the style file `import 'react-tooltip/dist/react-tooltip.css`
101+
If you want a styled tooltip, don't forget to add the style file `import 'react-tooltip/dist/react-tooltip.css`.
102+
103+
Basic styling can be done by overriding the following css variables.
104+
105+
```css
106+
:root {
107+
--rt-color-white: #fff;
108+
--rt-color-dark: #222;
109+
--rt-color-success: #8dc572;
110+
--rt-color-error: #be6464;
111+
--rt-color-warning: #f0ad4e;
112+
--rt-color-info: #337ab7;
113+
--rt-opacity: 0.9;
114+
}
115+
```
116+
117+
For advanced styling, check [the examples](./examples/styling.mdx).

src/components/Tooltip/styles.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
.show {
3333
visibility: visible;
34-
opacity: 0.9;
34+
opacity: var(--rt-opacity);
3535
}
3636

3737
/** Types variant **/

src/tokens.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
--rt-color-error: #be6464;
66
--rt-color-warning: #f0ad4e;
77
--rt-color-info: #337ab7;
8+
--rt-opacity: 0.9;
89
}

0 commit comments

Comments
 (0)