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

# Active vs Passive Voice

> The clarity and tone of our language significantly impacts the user experience.

export const LiveCode = ({children, customHeight, clickToLoad, example, fullWidth, fullHeight, hideCodeInLiveCode, screenshot, screenshotOnly, showCode: showCodeProp}) => {
  const SCREENSHOTS_BASE = "https://servicetitan.github.io/anvil2-docs-live-code/screenshots";
  const STACKBLITZ_BASE = "https://stackblitz.com/github/servicetitan/anvil2-docs-live-code/tree/main/examples";
  const [showCodeBlock, setShowCodeBlock] = useState(showCodeProp ?? false);
  const [isLocalOverride, setIsLocalOverride] = useState(false);
  useEffect(() => {
    const examplePath = `/images/live-code-screenshots-tmp/${example}.png`;
    fetch(examplePath, {
      method: "HEAD"
    }).then(r => {
      if (r.ok) setIsLocalOverride(true);
    }).catch(() => {});
  }, [example]);
  const screenshotBase = isLocalOverride ? "/images/live-code-screenshots-tmp" : SCREENSHOTS_BASE;
  if (screenshotOnly) {
    return <Frame className="flex flex-col">
        <div className="flex dark:hidden" style={{
      justifyContent: "center",
      alignItems: "center",
      width: fullWidth ? "100%" : "50%",
      minHeight: fullHeight ? "284px" : undefined,
      background: "#FFFFFF"
    }}>
          <img srcset={`${screenshotBase}/${example}.png, ${screenshotBase}/${example}-2x.png 2x`} src={`${screenshotBase}/${example}.png`} alt={example} noZoom />
        </div>
        <div className="hidden dark:flex" style={{
      justifyContent: "center",
      alignItems: "center",
      width: fullWidth ? "100%" : "50%",
      minHeight: fullHeight ? "284px" : undefined,
      background: "#141414"
    }}>
          <img srcset={`${screenshotBase}/${example}-dark.png, ${screenshotBase}/${example}-dark-2x.png 2x`} src={`${screenshotBase}/${example}-dark.png`} alt={example} noZoom />
        </div>
      </Frame>;
  }
  if (screenshot) {
    return <Frame className="flex flex-col -mb-2">
        <div className="flex dark:hidden bg-white dark:bg-codeblock border border-gray-950/10 dark:border-white/10 dark:twoslash-dark rounded-2xl overflow-hidden" style={{
      justifyContent: "center",
      alignItems: "center",
      width: fullWidth ? "100%" : "50%",
      minHeight: fullHeight ? "284px" : undefined
    }}>
          <img srcset={`${screenshotBase}/${example}.png, ${screenshotBase}/${example}-2x.png 2x`} src={`${screenshotBase}/${example}.png`} alt={example} noZoom />
        </div>

        <div className="hidden dark:flex bg-white dark:bg-codeblock border border-gray-950/10 dark:border-white/10 dark:twoslash-dark rounded-2xl overflow-hidden" style={{
      background: "#141414",
      justifyContent: "center",
      alignItems: "center",
      width: fullWidth ? "100%" : "50%",
      minHeight: fullHeight ? "284px" : undefined
    }}>
          <img srcset={`${screenshotBase}/${example}-dark.png, ${screenshotBase}/${example}-dark-2x.png 2x`} src={`${screenshotBase}/${example}-dark.png`} alt={example} noZoom />
        </div>

        <div className="flex justify-end items-center text-xs py-2 px-1 gap-4">
          {!showCodeProp ? <button className="inline-flex justify-end items-center text-gray-700 dark:text-gray-50 hover:text-blue-500 dark:hover:text-blue-300 transition-colors group self-end gap-1 cursor-pointer" onClick={() => setShowCodeBlock(!showCodeBlock)} style={{
      appearance: "none"
    }}>
              <Icon icon="code" size="12px" className="group-hover:bg-blue-500 dark:group-hover:bg-blue-300" />
              <span>{showCodeBlock ? "Hide code" : "Show code"}</span>
            </button> : null}

          <a className="inline-flex justify-end items-center hover:text-blue-500 dark:hover:text-blue-300 transition-colors group self-end gap-1" href={`${STACKBLITZ_BASE}/${example}?file=src/App.tsx`} target="_blank" rel="noreferrer">
            <Icon icon="bolt" size="12px" className="group-hover:bg-blue-500 dark:group-hover:bg-blue-300" />
            <span>StackBlitz demo</span>
          </a>
        </div>

        <div className="grid transition-[grid-template-rows] duration-300 ease-in-out overflow-auto overflow-y-hidden overflow-x-auto" style={showCodeBlock ? {
      gridTemplateRows: "1fr"
    } : {
      gridTemplateRows: "0fr"
    }}>
          <div style={{
      minHeight: 0,
      overflowX: "auto",
      overflowY: "hidden",
      marginBlockStart: "-1.25rem",
      marginBlockEnd: "-1.5rem"
    }}>
            {children}
          </div>
        </div>
      </Frame>;
  } else {
    return <div style={{
      display: "flex",
      width: fullWidth ? "100%" : "50%",
      minHeight: customHeight ? customHeight : "316px",
      resize: "vertical",
      overflow: "auto"
    }}>
        <iframe title={example} style={{
      flex: 1,
      width: fullWidth ? "100%" : "50%",
      minHeight: customHeight ? customHeight : "316px"
    }} src={`${STACKBLITZ_BASE}/${example}?embed=1&hideNavigation=1&hideExplorer=1&terminalHeight=0&file=src/App.tsx${clickToLoad ? "&ctl=1" : ""}${hideCodeInLiveCode ? "&view=preview" : ""}`} allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking" sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts" />
      </div>;
  }
};

The choice between active and passive voice is an important aspect of crafting effective and engaging in-app copy.

### Overview

**Active voice** generally enhances the readability and directness of our content, making it easier for users to understand and act upon. It places the subject at the forefront, highlighting who is performing the action. This approach aligns with modern communication practices, promoting a friendly and approachable tone.

**Passive voice**, although less commonly used, has its place in certain contexts where the action or result is more important than the actor, or when we need to be more tactful or indirect.

### Active Voice

Active voice enhances user experience in several key ways:

* **Clarity and Directness**: Active voice makes sentences clearer and more direct. It helps users understand who is performing an action.
* **Engagement**: Active voice is more engaging and friendly, which improves user experience.
* **Efficiency**: Active sentences are usually shorter and more concise, making the copy easier to read and understand.

#### Key pointers

* **Subject-Action-Object Structure**: Ensure that your sentences follow the Subject-Action-Object structure for clarity.\
  Example: *The system updates your settings.* (Active) vs. *Your settings are updated by the system.* (Passive)
* **Personal Pronouns**: Use personal pronouns like "you" to make the copy more relatable and engaging.\
  Example: *You can reset your password from the settings.* (Active) vs. *The password can be reset from the settings.* (Passive)
* **Command Verbs**: Use command verbs to make instructions clear and direct.\
  Example: *Upload your document.* (Active) vs. *Your document should be uploaded.* (Passive)

#### Examples

#### Active voice for instructions

<LiveCode example="activevspassivevoice-instructions-do" screenshot fullWidth>
  ```tsx lines theme={null}
  import { Text, Flex } from "@servicetitan/anvil2";

  function App() {
    return (
      <Flex direction="column" gap="3">
        <Text>Click Submit to save your changes.</Text>
      </Flex>
    );
  }

  export default App;
  ```
</LiveCode>

<Check>**Do**</Check>

<LiveCode example="activevspassivevoice-instructions-dont" screenshot fullWidth>
  ```tsx lines theme={null}
  import { Text, Flex } from "@servicetitan/anvil2";

  function App() {
    return (
      <Flex direction="column" gap="3">
        <Text>The Submit button should be clicked to save your changes.</Text>
      </Flex>
    );
  }

  export default App;
  ```
</LiveCode>

<Danger>**Don't**</Danger>

#### Active voice for error messages

<LiveCode example="activevspassivevoice-error-do" screenshot fullWidth>
  ```tsx lines theme={null}
  import { toast } from "@servicetitan/anvil2";
  import { useEffect, useRef } from "react";

  function App() {
    const firstRenderRef = useRef(true);

    useEffect(() => {
      if (firstRenderRef.current) {
        firstRenderRef.current = false;

        toast.danger({
          title: "We couldn't process your payment.",
          message: "Please check your payment method details and try again.",
        });
      }
    }, []);

    return <div style={{ height: "300px" }}></div>;
  }

  export default App;
  ```
</LiveCode>

<Check>**Do**</Check>

<LiveCode example="activevspassivevoice-error-dont" screenshot fullWidth>
  ```tsx lines theme={null}
  import { toast } from "@servicetitan/anvil2";
  import { useEffect, useRef } from "react";

  function App() {
    const firstRenderRef = useRef(true);

    useEffect(() => {
      if (firstRenderRef.current) {
        firstRenderRef.current = false;

        toast.danger({
          title: "Request failed",
          message: "Your payment couldn't be processed.",
        });
      }
    }, []);

    return <div style={{ height: "300px" }}></div>;
  }

  export default App;
  ```
</LiveCode>

<Danger>**Don't**</Danger>

### Passive Voice

While active voice is generally preferred for clarity and engagement, there are a few instances where passive voice may be more appropriate.

#### Key pointers

* **Focus on relevance**: Use passive voice when it helps focus on what is most relevant to the user.\
  *Example:* An error has occurred. (Passive) vs. The system encountered an error. (Active, but actor might be irrelevant)
* **Soften impact**: Use passive voice to deliver potentially negative information more gently.\
  *Example:* Your submission was not accepted. (Passive) vs. We did not accept your submission. (Active, but harsher)

#### Examples

#### Emphasizing the action or result

When the outcome or action itself is more critical than who performed it.

**Reasoning:** The important information is that the account creation was successful, not who created it.

<LiveCode example="activevspassivevoice-result-do" screenshot fullWidth>
  ```tsx lines theme={null}
  import { toast } from "@servicetitan/anvil2";
  import { useEffect, useRef } from "react";

  function App() {
    const firstRenderRef = useRef(true);

    useEffect(() => {
      if (firstRenderRef.current) {
        firstRenderRef.current = false;

        toast.success({
          title: "Registration Successful",
          message: "Your account has been created.",
        });
      }
    }, []);

    return <div style={{ height: "300px" }}></div>;
  }

  export default App;
  ```
</LiveCode>

<Check>**Do**</Check>

<LiveCode example="activevspassivevoice-result-dont" screenshot fullWidth>
  ```tsx lines theme={null}
  import { toast } from "@servicetitan/anvil2";
  import { useEffect, useRef } from "react";

  function App() {
    const firstRenderRef = useRef(true);

    useEffect(() => {
      if (firstRenderRef.current) {
        firstRenderRef.current = false;

        toast.success({
          title: "Registration Successful",
          message: "We created your account.",
        });
      }
    }, []);

    return <div style={{ height: "300px" }}></div>;
  }

  export default App;
  ```
</LiveCode>

<Danger>**Don't**</Danger>

#### Politeness and tact

When delivering bad news or feedback gently.

**Reasoning:** Softens the impact of the denial.

<LiveCode example="activevspassivevoice-tact-do" screenshot fullWidth>
  ```tsx lines theme={null}
  import { Text, Flex } from "@servicetitan/anvil2";

  function App() {
    return (
      <Flex direction="column" gap="3">
        <Text>Your request has been denied.</Text>
      </Flex>
    );
  }

  export default App;
  ```
</LiveCode>

<Check>**Do**</Check>

<LiveCode example="activevspassivevoice-tact-dont" screenshot fullWidth>
  ```tsx lines theme={null}
  import { Text, Flex } from "@servicetitan/anvil2";

  function App() {
    return (
      <Flex direction="column" gap="3">
        <Text>We denied your request.</Text>
      </Flex>
    );
  }

  export default App;
  ```
</LiveCode>

<Danger>**Don't**</Danger>

#### Actor is unknown or irrelevant

When it doesn’t matter who performed the action.

**Reasoning:** Focuses on the action users need to know.

<LiveCode example="activevspassivevoice-actor-do" screenshot fullWidth>
  ```tsx lines theme={null}
  import { toast } from "@servicetitan/anvil2";
  import { useEffect, useRef } from "react";

  function App() {
    const firstRenderRef = useRef(true);

    useEffect(() => {
      if (firstRenderRef.current) {
        firstRenderRef.current = false;

        toast.success({
          title: "Changes saved.",
          message: "You have successfully updated your profile.",
        });
      }
    }, []);

    return <div style={{ height: "300px" }}></div>;
  }

  export default App;
  ```
</LiveCode>

<Check>**Do**</Check>

<LiveCode example="activevspassivevoice-actor-dont" screenshot fullWidth>
  ```tsx lines theme={null}
  import { toast } from "@servicetitan/anvil2";
  import { useEffect, useRef } from "react";

  function App() {
    const firstRenderRef = useRef(true);

    useEffect(() => {
      if (firstRenderRef.current) {
        firstRenderRef.current = false;

        toast.success({
          title: "Changes saved.",
          message: "Your profile has been successfully updated.",
        });
      }
    }, []);

    return <div style={{ height: "300px" }}></div>;
  }

  export default App;
  ```
</LiveCode>

<Danger>**Don't**</Danger>
