Skip to main content

Dialog

Classic variant

Example banner Example banner

Default variant

Example banner Example banner

Implementation code

Wrap your app.js code with PortalProvider component to use dialog.

import { PortalProvider, NativeProvider } from '@nexara/nativeflow';
import Component from './path';

const App = () => {
return (
<NativeProvider>
<PortalProvider>
<Component/>
</PortalProvider>
</NativeProvider>
)
}
export default App;
  • Classic variant

import { Dialog, DialogHead, DialogBody, DialogDescription, DialogFoot, Button } from '@nexara/nativeflow';

const Component = () => {

const dialogRef = useRef<DialogRefProps>(null);

return (
<Button
title='Cancel'
onPress={()=> dialogRef.current.open()}
/>
<Dialog ref={dialogRef} size='lg' variant='classic' onClose={() => {}}>
<DialogHead title='Invite your team' />
<DialogBody>
<DialogDescription textStyle={{ fontStyle: 'italic' }}>
Elevate user interactions with our versatile modals. Seamlessly integrate notifications, forms, and media displays. Make an impact effortlessly.
</DialogDescription>
</DialogBody>
<DialogFoot>
<Button
variant='outlined'
title='Explore'
paddingV={10}
fScale='sm'
stroke={0}
/>
<Button
variant='outlined'
title='Explore'
paddingV={10}
fScale='sm'
stroke={0}
/>
</DialogFoot>
</Dialog>
);
}
export default Component;
  • Default variant

import { Dialog, DialogHead, DialogBody, DialogDescription, DialogFoot, Button } from '@nexara/nativeflow';

const Component = () => {

const dialogRef = useRef<DialogRefProps>(null);

return (
<Button
title='Cancel'
onPress={()=> dialogRef.current.open()}
/>
<Dialog ref={dialogRef} onClose={() => {}} >
<DialogHead title='Contact US' />
<DialogBody >
<UserInput
label='Name'
/>
<UserInput
label='Email'
/>
<DialogDescription textStyle={{ fontStyle: 'italic' }}>
Elevate user interactions with our versatile modals. Seamlessly integrate notifications, forms, and media displays. Make an impact effortlessly.
</DialogDescription>
</DialogBody>
<DialogFoot>
<Button
variant='outlined'
title='Explore'
paddingV={10}
fScale='sm'
stroke={0}
/>
<Button
variant='outlined'
title='Explore'
paddingV={10}
fScale='sm'
stroke={0}
/>
</DialogFoot>
</Dialog>
);
}
export default Component;

Props

Dialog Props

PropTypeDefaultDescription
variant'classic' | 'default''classic'Defines the style variant of the dialog.
size'xs' | 'sm' | 'md' | 'lg' | 'full''lg'Sets the horizontal size of the dialog.
fullScreenbooleanfalseMakes the dialog cover the entire screen when true.
backdropColorstringtheme.colors.background.backdropSets the background color of the backdrop.
onClose() => voidCallback triggered when the dialog is closed (backdrop press or hardware back button).
containerStyleStyleProp<ViewStyle>Custom styles for the dialog container.
childrenReactNodeContent to be displayed inside the dialog.
refDialogRefPropsRef object used to programmatically open or close the dialog (open / close).
  • Dialog Ref Methods

MethodDescription
open()Opens the dialog programmatically
close()Closes the dialog programmatically

Dialog Head Props

PropTypeDefaultDescription
titlestringTitle text displayed in the dialog header. If not provided, children will be rendered.
fScaleTypographyScale'xl'Typography scale of the title text (e.g., xs, sm, md, lg, xl).
fsnumberFont size of the title text (overrides fScale if provided).
ffstringFont family of the title text.
titleStyleStyleProp<TextStyle>Custom styles for the title text.
containerStyleStyleProp<ViewStyle>Custom styles for the container wrapping the dialog header.
childrenReactNodeAdditional elements or components rendered inside the dialog header, used if title is not provided.

Dialog Body Props

PropTypeDefaultDescription
scrollEnablebooleantrueEnables or disables scrolling when content overflows from the parent.
containerStyleStyleProp<ViewStyle>Custom styles for the dialog body container.
childrenReactNodeContent to be rendered inside the dialog body.

Dialog Description Props

PropTypeDefaultDescription
fScaleTypographyScale'sm'Typography scale applied to the description text.
fsnumberFont size of the description text (overrides fScale if provided).
containerStyleStyleProp<ViewStyle>Custom styles for the container wrapping the dialog description.
textStyleStyleProp<TextStyle>Custom styles for the description text itself.
childrenReactNodeContent to be rendered inside the dialog description.

Dialog Foot Props

PropTypeDefaultDescription
containerStyleStyleProp<ViewStyle>Custom styles for the container wrapping the dialog footer.
childrenReactNodeContent to be rendered inside the dialog footer.