Divider
Organize content visually with separators for a more structured, easy-to-read interface.
Installation
API Reference
Spec Doc
This is an illustration of Divider component.
<Center><Text className="font-semibold">Easy</Text><Divider className="my-0.5" /><Text className="font-semibold">Difficult</Text></Center>
Installation
CLI
Manual
Run the following command:
npx gluestack-ui add divider
API Reference
To use this component in your project, include the following import statement in your file.
import { Divider } from "@/components/ui/divider"
export default () => <Divider />
Component Props
This section provides a comprehensive reference list for the component props, detailing descriptions, properties, types, and default behavior for easy project integration.
Divider
It inherits all the properties of React Native's View component.
Props
Divider component is created using View component from react-native. It extends all the props supported by React Native View, utility props and the props mentioned below.
Divider
Name | Value | Default |
---|---|---|
orientation | vertical | horizontal | horizontal |
Examples
The Examples section provides visual representations of the different variants of the component, allowing you to quickly and easily determine which one best fits your needs. Simply copy the code and integrate it into your project.
Variants
A Divider component with different layouts offers versatile options for visually dividing content in various arrangements, such as horizontal or vertical orientations, enabling flexible and visually appealing designs for organizing and structuring elements within a user interface.
<VStack><Heading>gluestack-ui</Heading><Text>Universal component library</Text><Divider className="my-2 bg-indigo-500" /><HStack className=""><Text>Installation</Text><Divider orientation="vertical" className="mx-2 h-[20px] bg-emerald-500" /><Text>API Reference</Text><Divider orientation="vertical" className="mx-2 h-[20px] bg-emerald-500" /><Text>Examples</Text></HStack></VStack>
Orientation
A Divider component with a specified divider orientation allows for clear visual separation of content, either horizontally or vertically, providing a structured and organized layout within a user interface.
<VStack space="lg" className="p-12 border border-outline-300 rounded-lg mx-5"><Box><Text size="xs" className="font-bold text-blue-600">HEALTH</Text><Heading>Benefits of Oranges</Heading><Text size="sm" className="mt-1.5">Oranges are a great source of vitamin C, which is essential for a healthyimmune system.</Text><HStack space="sm" className="mt-3 h-5"><Text size="xs">Wade Warrem</Text><Divider orientation="vertical" className="bg-gray-300" /><Text size="xs">6th Oct, 2019</Text><Divider orientation="vertical" className="bg-gray-300" /><Text size="xs">5 mins read</Text></HStack></Box><Divider className="bg-gray-300" /><Box><Text size="xs" className="font-bold text-blue-600">TECHNOLOGY</Text><Heading>How AI can benefit your business</Heading><Text size="sm" className="mt-1.5">AI can automate tasks and processes, allowing for increasing efficiencyand productivity.</Text><HStack space="sm" className="mt-3 h-5"><Text size="xs">Wade Warrem</Text><Divider orientation="vertical" className="bg-gray-300" /><Text size="xs">6th Oct, 2019</Text><Divider orientation="vertical" className="bg-gray-300" /><Text size="xs">5 mins read</Text></HStack></Box></VStack>
With & Without Inset
A Divider component used with or without inset adds visual hierarchy and distinction by creating a dividing line either with or without indentation, providing options for organizing and structuring content within a user interface.
<VStack space="2xl"><HStack className="px-3 h-8 rounded border border-solid border-outline-300"><Button variant="link" size="xs"><ButtonText>Github</ButtonText></Button><Divider orientation="vertical" className="mx-2.5" /><Button variant="link" size="xs"><ButtonText>Twitter</ButtonText></Button><Divider orientation="vertical" className="mx-2.5" /><Button variant="link" size="xs"><ButtonText>Discord</ButtonText></Button></HStack><HStack className="px-3 h-8 rounded border border-solid border-outline-300 items-center"><Button variant="link" size="xs"><ButtonText>Github</ButtonText></Button><Divider orientation="vertical" className="h-[50%] mx-2.5" /><Button variant="link" size="xs"><ButtonText>Twitter</ButtonText></Button><Dividerorientation="vertical"className="h-[50%]mx-2.5"/><Button variant="link" size="xs"><ButtonText>Discord</ButtonText></Button></HStack></VStack>
Adding content within a Divider
A Divider component with added content allows for the inclusion of additional text or elements alongside the dividing line, enhancing the visual and informational aspects of the divider while providing a seamless integration of content within a user interface.
<BoxclassName="py-9 px-20 m-5 rounded-lgborder border-outline-300"><Heading size="3xl">Search Results</Heading><Divider className="mt-4 mb-6" /><Box><Text size="xs" className="font-bold text-amber-700">TECHNOLOGY</Text><Heading>How AI can benefit your business</Heading><Text size="sm" className="mt-1.5">AI can automate tasks and processes, allowing for increasing efficiencyand productivity.</Text><HStack space="sm" className="mt-3 items-center"><Divider className="w-[18px] bg-amber-700" /><Text size="xs" className="text-amber-700">5 mins read</Text></HStack></Box></Box>