microsoft / microsoft/AdaptiveCards

Add "Link" to ActionStyle and TextColor to Action

Open
#5,548 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Design Discussion - Needed Epic Feature Partner-Doist
Dominant language
C#
Stars
2k
Forks
595
Avg merge
1d 19h
Merged PRs (30d)
1

Description

What platform is your feature request related to? (Delete other platforms).

  • .NET HTML

  • .NET WPF

  • Android

  • iOS

  • JavaScript

  • UWP

Is your feature request related to a problem? Please describe.
Basically I want a quick and easy way to create a button that is just text (like a hyperlink).

Describe the solution you'd like
I mostly deal with nodejs, but this would likely affect all platforms

What I would like to see is are two relatively small changes to Actions:

  • Add a "Link" style to the ActionStyle enum, so this would give "Default", "Positive", "Destructive", and "Link". This would render the Action's title as a text hyperlink, rather than an actual button. (In UWP terms, think HyperlinkButton vs Button).

  • Add a color field to the Actions which would only be used when the ActionStyle is "link". This would use the existing TextColor enum ("default", "subtle", etc) which would allow that rendered link to appear in the requested color.

With the requested changes, the json for a text-based button would then look like:

{
    "type": "Action.Submit",
    "title": "link to something",
    "id": "myAction",
    "style": "link",
    "color": "attention"
}

Describe alternatives you've considered
When I want to create an Action that is just text, I'm having to use the following json:

{
    "type": "ColumnSet",
    "columns": [
        {
            "type": "Column",
            "width": "stretch",
            "items": [
                {
                    "type": "TextBlock",
                    "text": "Link to something",
                    "wrap": true,
                    "color": "attention"
                }
            ],
            "selectAction": {
                "type": "Action.Submit",
                "id": "myAction"
            }
        }
    ]
}

This means when displaying a list of items that may have, say, two of these types of links, the amount of json that is being sent to the host is growing at quite a large rate

I know another workaround that would reduce the json a little more would be to use a RichTextBlock, so the json would be

"type": "RichTextBlock",
"inlines": [
    {
        "type": "TextRun",
        "text": "New RichTextBlock",
        "selectAction": {
            "type": "Action.Submit",
            "id": "myAction"
        }
    }
]

But this still feels like a workaround when just having a link type for action would make much better sense and would be a bit more obvious over how to actually create this type of linked button.

image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the ActionStyle and TextColor definitions and the Action model or schema entry points. Check how actions are rendered across the listed platforms. Done means Link style and color are represented consistently and render text-based actions with the requested color, with platform behavior and compatibility addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.