General Styling
Simplify styling needs with the help of AI
Summary
Example: Using generative AI to align elements in a modern web app
Prompt:
Create a Next.js and Chakra UI component with a centered title and a horizontally aligned list of items.Response:
import React from 'react';
import { Box, Flex, Heading, List, ListItem, Text } from '@chakra-ui/react';
const CenteredTitleAndHorizontalList = () => {
const items = ['Item 1', 'Item 2', 'Item 3'];
return (
<Box>
<Heading textAlign="center" mb="4">
Centered Title
</Heading>
<Flex justifyContent="space-evenly">
<List display="flex" alignItems="center">
{items.map((item, index) => (
<ListItem key={index} mx="2">
<Text>{item}</Text>
</ListItem>
))}
</List>
</Flex>
</Box>
);
};
export default CenteredTitleAndHorizontalList;Last updated