> ## Documentation Index
> Fetch the complete documentation index at: https://docs.frankieone.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Result

The Result screen is a versatile component that displays outcome messages at any point in your onboarding flow. It handles both success and failure scenarios, and can be embedded anywhere in your application.

## Available Result Types

<CardGroup cols={2}>
  <Card title="Success" icon="circle-check">
    Displays when a process completes successfully
  </Card>

  <Card title="Fail" icon="circle-xmark">
    Shows when an operation encounters an error
  </Card>

  <Card title="Partial Match" icon="circle-half-stroke">
    Indicates when some criteria are met but others aren't
  </Card>

  <Card title="Pending" icon="clock">
    Represents operations that are still in progress
  </Card>
</CardGroup>

<Frame caption="Result screen variations">
  <img src="https://mintcdn.com/frankieone-f5583b1b/MpEYW70dy4W-choU/images/docs/image-20240919-014206.png?fit=max&auto=format&n=MpEYW70dy4W-choU&q=85&s=38fa5e5a7fa09b83fefd789327207632" alt="Result screen types" width="2200" height="1080" data-path="images/docs/image-20240919-014206.png" />
</Frame>

## Quick Start

<Steps>
  <Step title="Add HTML Container">
    ```html theme={null}
    <div id="form"></div>
    ```
  </Step>

  <Step title="Initialize Result Component">
    ```javascript theme={null}
    const result = oneSdk.component("form", {
      name: "RESULT",
      type: "manual",
      state: "SUCCESS",
      title: { label: "Complete" },
      descriptions: [{ label: "Process is now complete. You can close the page" }],
      cta: { label: "Done" },
    });
    ```
  </Step>

  <Step title="Mount Component">
    ```javascript theme={null}
    result.mount("#form");
    ```
  </Step>
</Steps>

## Configuration Options

<AccordionGroup>
  <Accordion title="Basic Properties">
    ```typescript theme={null}
    interface ResultConfig {
      name: "RESULT";            // Screen identifier
      type: "manual";            // Flow type
      state: ResultState;        // Screen state
      title: TitleConfig;        // Title configuration
      descriptions: Description[]; // Description array
      cta: CTAConfig;           // Call-to-action button
    }
    ```
  </Accordion>

  <Accordion title="State Types">
    ```typescript theme={null}
    type ResultState = | "SUCCESS" /* Success completion */
    | "FAIL" /* Operation failed */
    | "PARTIAL" /* Partial match */
    | "PENDING"; /* In progress */
    ```
  </Accordion>

  <Accordion title="Component Parts">
    <CardGroup cols={3}>
      <Card title="Title" icon="heading">
        ```typescript theme={null}
        interface TitleConfig {
          label: string;
          style?: "ff-title";
        }
        ```
      </Card>

      <Card title="Descriptions" icon="align-left">
        ```typescript theme={null}
        interface Description {
          label: string;
          style?: "ff-description";
        }
        ```
      </Card>

      <Card title="CTA Button" icon="square-caret-right">
        ```typescript theme={null}
        interface CTAConfig {
          label: string;
          style?: "ff-button";
        }
        ```
      </Card>
    </CardGroup>
  </Accordion>
</AccordionGroup>

## Event Handling

```javascript Listen for Result Events theme={null}
// Component loaded
oneSdk.on('form:result:loaded', () => {
  console.log('Result screen loaded');
});

// Success button clicked
oneSdk.on('form:result:success', () => {
  console.log('Success action triggered');
});

// Failure button clicked
oneSdk.on('form:result:failed', () => {
  console.log('Failure action triggered');
});
```

| Event Name            | Description                              |
| :-------------------- | :--------------------------------------- |
| `form:result:loaded`  | Emitted when screen loads                |
| `form:result:success` | Triggered on success screen button click |
| `form:result:failed`  | Triggered on fail screen button click    |
| `form:result:partial` | Triggered on partial match button click  |
| `form:result:pending` | Triggered on pending screen button click |

## Styling Guide

<CardGroup cols={2}>
  <Card title="Title" icon="text-height">
    ```css theme={null}
    .ff-title {
      /* custom css */
    }
    ```
  </Card>

  <Card title="Subtitle" icon="text-size">
    ```css theme={null}
    .ff-subtitle {
      /* custom css */
    }
    ```
  </Card>

  <Card title="Description" icon="text-width">
    ```css theme={null}
    .ff-description {
      /* custom css */
    }
    ```
  </Card>

  <Card title="Logo" icon="image">
    ```css theme={null}
    .ff-logo {
      /* custom css */
    }
    ```
  </Card>
</CardGroup>

<Callout icon="star" color="#3DD892" iconType="regular">
  ##### Styling Best Practices

  * Use CSS classes for consistent styling across all result screens
  * Override specific styles using the configuration object when needed
  * Keep styling consistent with your application’s theme
</Callout>
