{ "name": "alert", "file": "compositions/ui/alert", "snippet": "import { Alert as ChakraAlert } from \"@chakra-ui/react\"\nimport * as React from \"react\"\n\nexport interface AlertProps extends Omit {\n startElement?: React.ReactNode\n endElement?: React.ReactNode\n title?: React.ReactNode\n icon?: React.ReactElement\n}\n\nexport const Alert = React.forwardRef(\n function Alert(props, ref) {\n const { title, children, icon, startElement, endElement, ...rest } = props\n return (\n \n {startElement || {icon}}\n {children ? (\n \n {title}\n {children}\n \n ) : (\n {title}\n )}\n {endElement}\n \n )\n },\n)\n", "examples": [ { "name": "alert-basic", "content": "export const AlertBasic = () => {\n return (\n \n \n This is the alert title\n \n )\n}\n", "hasSnippet": false, "importPaths": [ "import { Alert } from \"@chakra-ui/react\"" ], "importPath": "import { Alert } from \"@chakra-ui/react\"" }, { "name": "alert-closed-component", "content": "export interface AlertProps extends Omit {\n startElement?: React.ReactNode\n endElement?: React.ReactNode\n title?: React.ReactNode\n icon?: React.ReactElement\n}\n\nexport const AlertClosedComponent = React.forwardRef<\n HTMLDivElement,\n AlertProps\n>(function Alert(props, ref) {\n const { title, children, icon, startElement, endElement, ...rest } = props\n return (\n \n {startElement || {icon}}\n {children ? (\n \n {title}\n {children}\n \n ) : (\n {title}\n )}\n {endElement}\n \n )\n})\n", "hasSnippet": false, "importPaths": [ "import { Alert as ChakraAlert } from \"@chakra-ui/react\"", "import * as React from \"react\"" ], "importPath": "import { Alert } from \"@chakra-ui/react\"" }, { "name": "alert-with-buttons", "content": "export const AlertWithButtons = () => {\n return (\n \n \n \n This is the alert title\n This is the alert description\n \n \n \n )\n}\n", "hasSnippet": false, "importPaths": [ "import { Alert, Button } from \"@chakra-ui/react\"" ], "importPath": "import { Alert } from \"@chakra-ui/react\"" }, { "name": "alert-with-close-button", "content": "export const AlertWithCloseButton = () => {\n return (\n \n \n \n Success!\n \n Your application has been received. We will review your application\n and respond within the next 48 hours.\n \n \n \n \n )\n}\n", "hasSnippet": false, "importPaths": [ "import { Alert, CloseButton } from \"@chakra-ui/react\"" ], "importPath": "import { Alert } from \"@chakra-ui/react\"" }, { "name": "alert-with-color-palette-override", "content": "export const AlertWithColorPaletteOverride = () => {\n return (\n \n \n This is an info alert but shown as teal\n \n )\n}\n", "hasSnippet": false, "importPaths": [ "import { Alert } from \"@chakra-ui/react\"" ], "importPath": "import { Alert } from \"@chakra-ui/react\"" }, { "name": "alert-with-custom-icon", "content": "export const AlertWithCustomIcon = () => {\n return (\n \n \n \n \n Submitting this form will delete your account\n \n )\n}\n", "hasSnippet": false, "importPaths": [ "import { Alert } from \"@chakra-ui/react\"", "import { LuAlarmClockPlus } from \"react-icons/lu\"" ], "importPath": "import { Alert } from \"@chakra-ui/react\"", "npmDependencies": [ "react-icons" ] }, { "name": "alert-with-customization", "content": "export const AlertWithCustomization = () => {\n return (\n \n \n \n \n \n \n Black Friday Sale (20% off)\n \n Upgrade your plan to get access to the sale.\n \n \n \n Upgrade\n \n \n\n \n \n \n Heads up: Black Friday Sale (20% off)\n \n \n \n )\n}\n", "hasSnippet": false, "importPaths": [ "import { Alert, Link, Stack } from \"@chakra-ui/react\"", "import { LuPercent } from \"react-icons/lu\"" ], "importPath": "import { Alert } from \"@chakra-ui/react\"", "npmDependencies": [ "react-icons" ] }, { "name": "alert-with-description", "content": "export const AlertWithDescription = () => {\n return (\n \n \n \n Invalid Fields\n \n Your form has some errors. Please fix them and try again.\n \n \n \n )\n}\n", "hasSnippet": false, "importPaths": [ "import { Alert } from \"@chakra-ui/react\"" ], "importPath": "import { Alert } from \"@chakra-ui/react\"" }, { "name": "alert-with-spinner", "content": "export const AlertWithSpinner = () => {\n return (\n \n \n \n \n We are loading something\n \n )\n}\n", "hasSnippet": false, "importPaths": [ "import { Alert, Spinner } from \"@chakra-ui/react\"" ], "importPath": "import { Alert } from \"@chakra-ui/react\"" }, { "name": "alert-with-status", "content": "export const AlertWithStatus = () => {\n return (\n \n \n \n There was an error processing your request\n \n\n \n \n \n Chakra is going live on August 30th. Get ready!\n \n \n\n \n \n \n Seems your account is about expire, upgrade now\n \n \n\n \n \n Data uploaded to the server. Fire on!\n \n \n )\n}\n", "hasSnippet": false, "importPaths": [ "import { Alert, Stack } from \"@chakra-ui/react\"" ], "importPath": "import { Alert } from \"@chakra-ui/react\"" }, { "name": "alert-with-variants", "content": "export const AlertWithVariants = () => {\n return (\n \n \n \n Data uploaded to the server. Fire on!\n \n\n \n \n Data uploaded to the server. Fire on!\n \n\n \n \n Data uploaded to the server. Fire on!\n \n \n )\n}\n", "hasSnippet": false, "importPaths": [ "import { Alert, Stack } from \"@chakra-ui/react\"" ], "importPath": "import { Alert } from \"@chakra-ui/react\"" } ] }