Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

TextField: Add layout example

Andrey Okonetchnikov6a0f481b0bca
diff --git a/packages/design-system/src/components/text-field.stories.tsx b/packages/design-system/src/components/text-field.stories.tsx
index 9ebbb0cd0a..9292176af8 100644
--- a/packages/design-system/src/components/text-field.stories.tsx
+++ b/packages/design-system/src/components/text-field.stories.tsx
@@ -5,6 +5,7 @@ import { Button } from "./button";
import { Flex } from "./flex";
import { IconButton } from "./icon-button";
import { TextField } from "./text-field";
+import { Box } from "./box";
export default {
component: TextField,
@@ -60,7 +61,7 @@ export const PrefixSuffix: ComponentStory<typeof TextField> = () => {
<TextField
prefix={<BrushIcon />}
suffix={
- <IconButton size={1}>
+ <IconButton>
<ChevronDownIcon />
</IconButton>
}
@@ -96,6 +97,31 @@ export const PrefixSuffix: ComponentStory<typeof TextField> = () => {
);
};
+export const Layout: ComponentStory<typeof TextField> = () => {
+ return (
+ <Flex direction="row" gap={2} css={{ justifyContent: "space-between" }}>
+ <TextField
+ value="Long content comes here and it doesn't wrap"
+ prefix={<BrushIcon />}
+ suffix={
+ <IconButton>
+ <ChevronDownIcon />
+ </IconButton>
+ }
+ css={{
+ flexGrow: 1,
+ maxWidth: "25%",
+ }}
+ />
+ <Box css={{ background: "$muted" }}>Content</Box>
+ <TextField
+ state="invalid"
+ value="Long content comes here and it doesn't wrap"
+ />
+ </Flex>
+ );
+};
+
export const Interactive: ComponentStory<typeof TextField> = () => {
const [value, setValue] = React.useState("");
const wrapperRef = React.useRef<HTMLDivElement>(null);