Result
Result displays success, error, or informational result screens with actions.
Featuresβ
- β Multiple variants (success, error, warning, info)
- πΌοΈ Icon support
- π Title and description
- π Action buttons
- π¨ Customizable
Basic Usageβ
import { Result } from '@tansuk/rott-ui';
<Result
variant="success"
title="Success"
description="Your payment was processed successfully"
actions={[
{
text: 'Done',
variant: 'primary',
onPress: () => navigation.navigate('Home'),
},
]}
/>
Variantsβ
<Result variant="success" title="Success" description="Operation completed" />
<Result variant="error" title="Error" description="Something went wrong" />
<Result variant="warning" title="Warning" description="Please review" />
<Result variant="info" title="Info" description="Additional information" />
With Custom Iconβ
<Result
variant="success"
iconName="CHECK_CIRCLE"
title="Payment Successful"
description="Your order has been confirmed"
actions={[
{ text: 'View Order', variant: 'primary', onPress: viewOrder },
{ text: 'Continue Shopping', variant: 'secondary-outline', onPress: continueShopping },
]}
/>
Propsβ
| Prop | Type | Description |
|---|---|---|
variant | 'success' | 'error' | 'warning' | 'info' | Result type |
iconName | IconKeys | Icon to display |
title | string | JSX.Element | Result title |
description | string | JSX.Element | Result description |
actions | ResultActionsProps[] | Action buttons |
headerTitle | string | Header title |
headerLogo | string | Header logo |
Examplesβ
Payment Successβ
<Result
variant="success"
title="Payment Successful"
description="Your payment of $99.99 has been processed"
actions={[
{
text: 'View Receipt',
variant: 'primary',
onPress: () => navigation.navigate('Receipt'),
},
{
text: 'Back to Home',
variant: 'secondary-outline',
onPress: () => navigation.navigate('Home'),
},
]}
/>
Error Screenβ
<Result
variant="error"
title="Payment Failed"
description="We couldn't process your payment. Please try again."
actions={[
{
text: 'Retry',
variant: 'primary',
onPress: retryPayment,
},
{
text: 'Cancel',
variant: 'secondary-outline',
onPress: () => navigation.goBack(),
},
]}
/>
Verification Pendingβ
<Result
variant="warning"
title="Verification Pending"
description="Please check your email to verify your account"
actions={[
{
text: 'Resend Email',
variant: 'primary',
onPress: resendVerification,
},
{
text: 'Change Email',
variant: 'secondary-outline',
onPress: changeEmail,
},
]}
/>