# Adaptive Card sample: Action.ToggleVisibility

- id: `toggle-visibility`
- Adaptive Card schema version: 1.5

Time-off request form with two collapsible sections (balance, comments) driven by Action.ToggleVisibility. Uses RichTextBlock selectAction, Icon chevrons, and responsive targetWidth containers in the original; the preview uses ActionSet buttons for compatibility.

## Elements

- `Action.ToggleVisibility` — targetElements — toggle balance section and comments
- `RichTextBlock + TextRun` — selectAction: Action.ToggleVisibility — inline clickable text
- `Icon` — ChevronDown/Up with selectAction toggle (HeartPulse, LeafOne, Beach)
- `targetWidth` — Wide / Standard / Narrow / VeryNarrow / AtMost:Standard / AtLeast:Narrow — responsive layout
- `Input.ChoiceSet` — dropdown — leave reason
- `Input.Toggle` — all day checkbox
- `Input.Date` — isRequired + errorMessage — leave date
- `Input.Number` — estimated days off
- `Input.Text` — isVisible: false, isMultiline — collapsible comments
- `Action.Submit` — style: positive — submit the form

## Card JSON

```json
{
  "type": "AdaptiveCard",
  "version": "1.5",
  "$schema": "https://adaptivecards.io/schemas/adaptive-card.json",
  "body": [
    {
      "type": "TextBlock",
      "text": "Time off request",
      "wrap": true,
      "size": "Large",
      "weight": "Bolder",
      "spacing": "None"
    },
    {
      "type": "Container",
      "id": "balanceSection",
      "isVisible": false,
      "style": "accent",
      "roundedCorners": true,
      "spacing": "Small",
      "items": [
        {
          "type": "ColumnSet",
          "columns": [
            {
              "type": "Column",
              "width": "stretch",
              "items": [
                {
                  "type": "TextBlock",
                  "text": "24h",
                  "color": "Accent",
                  "size": "ExtraLarge",
                  "weight": "Bolder",
                  "wrap": true
                },
                {
                  "type": "TextBlock",
                  "text": "Sick Days",
                  "weight": "Bolder",
                  "wrap": true,
                  "spacing": "None"
                },
                {
                  "type": "TextBlock",
                  "text": "Accrued at 8h / 3 months.",
                  "isSubtle": true,
                  "size": "Small",
                  "wrap": true,
                  "spacing": "ExtraSmall"
                }
              ]
            },
            {
              "type": "Column",
              "width": "stretch",
              "items": [
                {
                  "type": "TextBlock",
                  "text": "12h",
                  "color": "Accent",
                  "size": "ExtraLarge",
                  "weight": "Bolder",
                  "wrap": true
                },
                {
                  "type": "TextBlock",
                  "text": "Wellness",
                  "weight": "Bolder",
                  "wrap": true,
                  "spacing": "None"
                },
                {
                  "type": "TextBlock",
                  "text": "One time 5-day affordance / year.",
                  "isSubtle": true,
                  "size": "Small",
                  "wrap": true,
                  "spacing": "ExtraSmall"
                }
              ]
            },
            {
              "type": "Column",
              "width": "stretch",
              "items": [
                {
                  "type": "TextBlock",
                  "text": "32h",
                  "color": "Accent",
                  "size": "ExtraLarge",
                  "weight": "Bolder",
                  "wrap": true
                },
                {
                  "type": "TextBlock",
                  "text": "Paid time off",
                  "weight": "Bolder",
                  "wrap": true,
                  "spacing": "None"
                },
                {
                  "type": "TextBlock",
                  "text": "Accrued at 8h / month.",
                  "isSubtle": true,
                  "size": "Small",
                  "wrap": true,
                  "spacing": "ExtraSmall"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "type": "ActionSet",
      "actions": [
        {
          "type": "Action.ToggleVisibility",
          "title": "View current balance",
          "targetElements": [
            "balanceSection"
          ]
        }
      ]
    },
    {
      "type": "Input.ChoiceSet",
      "id": "leave_reason",
      "label": "Reason for leave",
      "value": "Vacation",
      "spacing": "Medium",
      "choices": [
        {
          "title": "Vacation",
          "value": "Vacation"
        },
        {
          "title": "Sick Day",
          "value": "Sick Day"
        },
        {
          "title": "Sick Leave",
          "value": "Sick Leave"
        },
        {
          "title": "Other",
          "value": "Other"
        }
      ]
    },
    {
      "type": "Input.Toggle",
      "id": "all_day",
      "title": "All day (8hrs)",
      "spacing": "Small"
    },
    {
      "type": "Input.Date",
      "id": "date",
      "label": "Date",
      "isRequired": true,
      "errorMessage": "Date is required"
    },
    {
      "type": "Input.Number",
      "id": "days_off",
      "label": "Estimated days off",
      "placeholder": "Select how many days",
      "spacing": "Medium"
    },
    {
      "type": "Input.Text",
      "id": "comments",
      "isVisible": false,
      "isMultiline": true,
      "placeholder": "Enter any comments"
    },
    {
      "type": "ActionSet",
      "actions": [
        {
          "type": "Action.ToggleVisibility",
          "title": "Add comments",
          "targetElements": [
            "comments"
          ]
        }
      ]
    },
    {
      "type": "ActionSet",
      "separator": true,
      "spacing": "ExtraLarge",
      "actions": [
        {
          "type": "Action.Submit",
          "title": "Submit",
          "style": "positive"
        }
      ]
    }
  ]
}
```
