+
+
#### Override styling using the classname and data attribute selectors:
+
Use the `amplify-ui-button` class and data attributes to style all buttons.
```css
@@ -160,27 +182,29 @@ Use the `amplify-ui-button` class and data attributes to style all buttons.
}
/* Example: Override only primary variant styles */
-.amplify-ui-button[data-variant=primary] {
+.amplify-ui-button[data-variant="primary"] {
background-color: teal;
color: white;
}
/* Example: Override loading styles */
-.amplify-ui-button[data-loading=true] {
+.amplify-ui-button[data-loading="true"] {
opacity: 0.8;
}
/* Example: Override disabled styles */
-.amplify-ui-button[disabled=true] {
+.amplify-ui-button[disabled="true"] {
opacity: 0.8;
}
/* Example: Override button styles using Tailwind CSS */
.amplify-ui-button {
- @apply bg-blue-500 hover:bg-blue-700 text-white;
+ @apply bg-blue-500 hover:bg-blue-700 text-white;
}
```
+
To replace the button styling, unset it:
+
```css
.amplify-ui-button {
all: unset;
@@ -189,9 +213,10 @@ To replace the button styling, unset it:
```
#### Styling a button instance
-To override styling on a specific button
-*Using an class selector:*
+To override styling on a specific button
+
+_Using an class selector:_
```css
/* Example: class selector styling override */
@@ -199,13 +224,14 @@ To override styling on a specific button
background: linear-gradient(90deg, #fdbb2d 0%, #22c1c3 100%);
}
```
+
```jsx
```
-
+
-*Using an id selector:*
+_Using an id selector:_
```css
/* Example: id selector styling override */
@@ -221,7 +247,9 @@ To override styling on a specific button
);
}
```
+
```jsx
```
+
diff --git a/docs/src/pages/ui/primitives/flex/demo.tsx b/docs/src/pages/ui/primitives/flex/demo.tsx
index 015c829c472..4c3f85bedcf 100644
--- a/docs/src/pages/ui/primitives/flex/demo.tsx
+++ b/docs/src/pages/ui/primitives/flex/demo.tsx
@@ -1,12 +1,8 @@
import { useState } from "react";
-import { Property } from 'csstype';
+import { Property } from "csstype";
-import {
- Flex,
- Button,
- View,
-} from "@aws-amplify/ui-react";
+import { Flex, Button, View } from "@aws-amplify/ui-react";
const JustifyContentProps: Property.JustifyContent[] = [
"flex-start",
@@ -60,9 +56,8 @@ const Direction = () => {
const Gap = () =>
{mockElements(3)};
const JustifyContent = () => {
- const [justifyContent, setJustifyContent] = useState
(
- "flex-start"
- );
+ const [justifyContent, setJustifyContent] =
+ useState("flex-start");
return (
@@ -105,9 +100,29 @@ const AlignItems = () => {
- Wow!
- I love to use
- Flex
+
+ Wow!
+
+
+ I love to use
+
+
+ Flex
+
);
@@ -148,7 +163,7 @@ const mockStyle = {
backgroundColor: "#805AD5",
};
-const mockElements = elements => {
+const mockElements = (elements) => {
const arr =
typeof elements === "number" ? [...Array(elements)] : [...elements];
return arr.map((char, i) => (
@@ -158,7 +173,7 @@ const mockElements = elements => {
));
};
-const selectDemo = demoType => {
+const selectDemo = (demoType) => {
switch (demoType) {
case "direction":
return ;
diff --git a/docs/src/pages/ui/primitives/text/demo.tsx b/docs/src/pages/ui/primitives/text/demo.tsx
index ba5755ef735..051fbc44255 100644
--- a/docs/src/pages/ui/primitives/text/demo.tsx
+++ b/docs/src/pages/ui/primitives/text/demo.tsx
@@ -21,7 +21,7 @@ export const TextDemo = ({ children }) => {
id="display_text"
name="display_text"
value={text}
- onChange={event => setText(event.target.value)}
+ onChange={(event) => setText(event.target.value)}
/>
@@ -35,7 +35,7 @@ export const TextDemo = ({ children }) => {
id="color"
name="color"
value={color}
- onChange={event => setColor(event.target.value)}
+ onChange={(event) => setColor(event.target.value)}
/>
@@ -49,7 +49,7 @@ export const TextDemo = ({ children }) => {
id="line_height"
name="line_height"
value={lineHeight}
- onChange={event => setLineHeight(event.target.value)}
+ onChange={(event) => setLineHeight(event.target.value)}
/>
@@ -63,7 +63,7 @@ export const TextDemo = ({ children }) => {
id="font_weight"
name="font_weight"
value={fontWeight}
- onChange={event => setFontWeight(event.target.value)}
+ onChange={(event) => setFontWeight(event.target.value)}
/>
@@ -77,7 +77,7 @@ export const TextDemo = ({ children }) => {
id="font_style"
name="font_style"
value={fontStyle}
- onChange={event => setFontStyle(event.target.value)}
+ onChange={(event) => setFontStyle(event.target.value)}
/>
@@ -91,7 +91,7 @@ export const TextDemo = ({ children }) => {
id="text_decoration"
name="text_decoration"
value={textDecoration}
- onChange={event => setTextDecoration(event.target.value)}
+ onChange={(event) => setTextDecoration(event.target.value)}
/>
@@ -105,7 +105,7 @@ export const TextDemo = ({ children }) => {
type="checkbox"
id="is_truncated"
name="is_truncated"
- onChange={event => setIsTruncated(!isTruncated)}
+ onChange={(event) => setIsTruncated(!isTruncated)}
/>
diff --git a/docs/src/pages/ui/primitives/view/demo.tsx b/docs/src/pages/ui/primitives/view/demo.tsx
index ad013258637..41117089be7 100644
--- a/docs/src/pages/ui/primitives/view/demo.tsx
+++ b/docs/src/pages/ui/primitives/view/demo.tsx
@@ -40,9 +40,8 @@ export const ViewDemo = ({ children }) => {
const [border, setBorder] = React.useState