TextBlock-element

Opmerking

Bouwt u Copilot-, Teams- of Outlook-scenario's op basis van adaptieve kaarten? Ga naar Adaptive Card Documentation Hub, de nieuwe one-stop-shop voor al uw adaptieve kaartbehoeften. Het bevat alle resources die u zoekt, inclusief volledige documentatie voor veel nieuwe functies, zoals Responsieve indeling, Pictogram, Badge, Carrousel, Grafieken en nog veel meer!

Deze pagina bevat documentatie voor het TextBlock-element in het Adaptive Cards-schema.

Belangrijke opmerking over toegankelijkheid: In versie 1.3 van het schema hebben we een labeleigenschap geïntroduceerd op Invoer om de toegankelijkheid te verbeteren. Als de Host-app die u als doel hebt , v1.3 ondersteunt, moet u een label gebruiken in plaats van een TextBlock , zoals in enkele voorbeelden hieronder wordt weergegeven. Zodra de meeste Host-apps zijn bijgewerkt naar de nieuwste versie, werken we de voorbeelden dienovereenkomstig bij.

TextBlock

Hiermee geeft u tekst weer, zodat u de tekengrootten, dikte en kleur kunt bepalen.

Eigenschappen van TextBlock

Vastgoed Typologie Verplicht Description Versie
type "TextBlock" Yes Moet "TextBlock"zijn. 1.0
tekst string Yes Tekst om weer te geven. Een subset van Markdown wordt ondersteund (https://aka.ms/ACTextFeatures) 1.0
kleur Colors? Nee. Hiermee bepaalt u de kleur van TextBlock elementen. 1.0
fontType FontType? Nee. Type lettertype dat moet worden gebruikt voor rendering 1.2
horizontalAlignment HorizontalAlignment? Nee. Hiermee bepaalt u de horizontale tekstuitlijning. Wanneer deze niet is opgegeven, wordt de waarde van horizontalAlignment overgenomen van de bovenliggende container. Als geen bovenliggende container de horizontale uitlijning heeft ingesteld, wordt deze standaard Links. 1.0
isSubtle boolean? Nee. Als true wordt weergegeven, wordt de tekst iets afgezwakt om minder prominent te lijken. 1.0
maxLines number Nee. Met deze optie specificeert u het maximale aantal regels dat moet worden weergegeven. 1.0
grootte FontSize? Nee. Hiermee bepaalt u de grootte van de tekst. 1.0
gewicht FontWeight? Nee. Bepaalt het gewicht van TextBlock elementen. 1.0
wikkelen boolean Nee. Als true, staat u toe dat tekst terugloopt. Anders wordt tekst geknipt. 1.0
stijl TextBlockStyle? Nee, standaard: "default" De stijl van dit TextBlock voor toegankelijkheidsdoeleinden. 1.5

Overgenomen eigenschappen

Vastgoed Typologie Verplicht Description Versie
Fallback Element, FallbackOption Nee. Hierin wordt beschreven wat u moet doen wanneer een onbekend element wordt aangetroffen of wanneer niet kan worden voldaan aan de vereisten van dit element of van eventuele onderliggende elementen. 1.2
hoogte BlockElementHeight Nee. Geeft de hoogte van het element op. 1.1
separator boolean Nee. Wanneer true, tekent u een scheidingslijn bovenaan het element. 1.0
Afstand Spacing Nee. Hiermee bepaalt u de hoeveelheid afstand tussen dit element en het voorgaande element. 1.0
ID string Nee. Een unieke id die is gekoppeld aan het item. 1.0
isVisible boolean Nee, standaard: true Als false, zal dit item worden verwijderd uit de visuele boom. 1.2
Vereist Dictionary<string> Nee. Een reeks sleutel-/waardeparen die aangeven welke functies het item nodig heeft met de bijbehorende minimale versie. Wanneer een functie ontbreekt of een onvoldoende versieniveau heeft, wordt fallback geactiveerd. 1.2

Example

Basistekstblok Voorbeeld (JSON)

{
	"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
	"type": "AdaptiveCard",
	"version": "1.0",
	"body": [
		{
			"type": "TextBlock",
			"text": "This is some text",
			"size": "large"
		},
		{
			"type": "TextBlock",
			"text": "It doesn't wrap by default",
			"weight": "bolder"
		},
		{
			"type": "TextBlock",
			"text": "So set **wrap** to true if you plan on showing a paragraph of text",
			"wrap": true
		},
		{
			"type": "TextBlock",
			"text": "You can also use **maxLines** to prevent it from getting out of hand",
			"wrap": true,
			"maxLines": 2
		},
		{
			"type": "TextBlock",
			"text": "You can even draw attention to certain text with color",
			"wrap": true,
			"color": "attention"
		}
	]
}

Eigenschappen

Tekst

Weer te geven tekst. Een subset van Markdown wordt ondersteund (https://aka.ms/ACTextFeatures)

  • Typ: string
  • Vereist: Ja

color

Hiermee bepaalt u de kleur van TextBlock elementen.

  • Typ: Colors?
  • Vereist: Nee
  • Toegestane waarden:
    • "default"
    • "dark"
    • "light"
    • "accent"
    • "good"
    • "warning"
    • "attention"

Voorbeeld van kleur (JSON)

{
	"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
	"type": "AdaptiveCard",
	"version": "1.0",
	"body": [
		{
			"type": "TextBlock",
			"text": "color: default",
			"color": "default"
		},
		{
			"type": "TextBlock",
			"text": "color: accent",
			"color": "accent"
		},
		{
			"type": "TextBlock",
			"text": "color: good",
			"color": "good"
		},
		{
			"type": "TextBlock",
			"text": "color: warning",
			"color": "warning"
		},
		{
			"type": "TextBlock",
			"text": "color: attention",
			"color": "attention"
		},
		{
			"type": "TextBlock",
			"text": "color: light",
			"color": "light"
		},
		{
			"type": "TextBlock",
			"text": "color: dark",
			"color": "dark"
		}
	]
}

fontType

Type lettertype dat moet worden gebruikt voor rendering

  • Typ: FontType?
  • Versie: 1.2
  • Vereist: Nee
  • Toegestane waarden:
    • "default"
    • "monospace"

FontType Example (JSON)

{
	"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
	"type": "AdaptiveCard",
	"version": "1.2",
	"body": [
		{
			"type": "TextBlock",
			"text": "Font type not set."
		},
		{
			"type": "TextBlock",
			"text": "Font type set to *default*.",
			"fontType": "default"
		},
		{
			"type": "TextBlock",
			"text": "Font type set to *monospace*.",
			"fontType": "monospace"
		}
	]
}

horizontale uitlijning

Hiermee bepaalt u de horizontale tekstuitlijning. Wanneer deze niet is opgegeven, wordt de waarde van horizontalAlignment overgenomen van de bovenliggende container. Als geen bovenliggende container de horizontale uitlijning heeft ingesteld, wordt deze standaard Links.

  • Typ: HorizontalAlignment?
  • Vereist: Nee
  • Toegestane waarden:
    • "left"
    • "center"
    • "right"

Voorbeeld van horizontale uitlijning (JSON)

{
	"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
	"type": "AdaptiveCard",
	"version": "1.0",
	"body": [
		{
			"type": "TextBlock",
			"text": "**horizontalAlignment:left**",
			"horizontalAlignment": "left"
		},
		{
			"type": "TextBlock",
			"text": "**horizontalAlignment:center**",
			"horizontalAlignment": "center"
		},
		{
			"type": "TextBlock",
			"text": "**horizontalAlignment:right**",
			"horizontalAlignment": "right"
		}
	]
}

isSubtle

Als true wordt weergegeven, wordt de tekst iets afgezwakt om minder prominent te lijken.

  • Typ: boolean?
  • Vereist: Nee

isSubtle Example (JSON)

{
	"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
	"type": "AdaptiveCard",
	"version": "1.0",
	"body": [
		{
			"type": "TextBlock",
			"text": "isSubtle:false",
			"isSubtle": false
		},
		{
			"type": "TextBlock",
			"text": "isSubtle:true",
			"isSubtle": true
		}
	]
}

maxLines

Met deze optie specificeert u het maximale aantal regels dat moet worden weergegeven.

  • Typ: number
  • Vereist: Nee

Voorbeeld van maxLines (JSON)

{
	"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
	"type": "AdaptiveCard",
	"version": "1.0",
	"body": [
		{
			"type": "TextBlock",
			"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
			"wrap": true,
			"maxLines": 1
		},
		{
			"type": "TextBlock",
			"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
			"wrap": true,
			"maxLines": 2
		}
	]
}

size

Hiermee bepaalt u de grootte van de tekst.

  • Typ: FontSize?
  • Vereist: Nee
  • Toegestane waarden:
    • "default"
    • "small"
    • "medium"
    • "large"
    • "extraLarge"

Groottevoorbeeld (JSON)

{
	"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
	"type": "AdaptiveCard",
	"version": "1.0",
	"body": [
		{
			"type": "TextBlock",
			"text": "size:default"
		},
		{
			"type": "TextBlock",
			"text": "size:small",
			"size": "small"
		},
		{
			"type": "TextBlock",
			"text": "size:default",
			"size": "default"
		},
		{
			"type": "TextBlock",
			"text": "size:medium",
			"size": "medium"
		},
		{
			"type": "TextBlock",
			"text": "size:large",
			"size": "large"
		},
		{
			"type": "TextBlock",
			"text": "size:extraLarge",
			"size": "extraLarge"
		}
	]
}

weight

Bepaalt het gewicht van TextBlock elementen.

  • Typ: FontWeight?
  • Vereist: Nee
  • Toegestane waarden:
    • "default"
    • "lighter"
    • "bolder"

Voorbeeld van gewicht (JSON)

{
	"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
	"type": "AdaptiveCard",
	"version": "1.0",
	"body": [
		{
			"type": "TextBlock",
			"text": "weight: lighter",
			"weight": "lighter"
		},
		{
			"type": "TextBlock",
			"text": "weight: default",
			"weight": "default"
		},
		{
			"type": "TextBlock",
			"text": "weight: bolder",
			"weight": "bolder"
		}
	]
}

omsluiten

Als true, staat u toe dat tekst terugloopt. Anders wordt tekst geknipt.

  • Typ: boolean
  • Vereist: Nee

Voorbeeld van omsluiten (JSON)

{
	"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
	"type": "AdaptiveCard",
	"version": "1.0",
	"body": [
		{
			"type": "TextBlock",
			"text": "**wrap: false** Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat",
			"wrap": false
		},
		{
			"type": "TextBlock",
			"text": "**wrap: true** Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
			"wrap": true
		}
	]
}

style

De stijl van dit TextBlock voor toegankelijkheidsdoeleinden.

  • Typ: TextBlockStyle?
  • Versie: 1.5
  • Vereist: Nee, standaard: "default"
  • Toegestane waarden:
    • "default": Dit is de standaardstijl die geen speciale stijl of gedrag biedt.
    • "heading": Het TextBlock is een kop. Hiermee past u de standaardinstellingen voor de kopstijl toe en markeert u de TextBlock kop als een kop voor toegankelijkheid.

Stijlvoorbeeld (JSON)

{
	"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
	"type": "AdaptiveCard",
	"version": "1.5",
	"body": [
		{
			"type": "TextBlock",
			"text": "Style set to heading",
			"style": "heading",
			"wrap": true
		},
		{
			"type": "TextBlock",
			"text": "Style set to heading, color set to good",
			"style": "heading",
			"color": "good",
			"wrap": true
		},
		{
			"type": "TextBlock",
			"text": "Style set to default",
			"style": "default",
			"wrap": true
		},
		{
			"type": "TextBlock",
			"text": "Style unset",
			"wrap": true
		}
	]
}

Fallback

Hierin wordt beschreven wat u moet doen wanneer een onbekend element wordt aangetroffen of wanneer niet kan worden voldaan aan de vereisten van dit of enige onderliggende elementen.

  • Type: Element, FallbackOption
  • Versie: 1.2
  • Vereist: Nee
  • Toegestane waarden:
    • ActionSet, , ColumnSet, , , Container, , , FactSetImageImageSetInput.ChoiceSetInput.DateInput.NumberInput.TextInput.TimeInput.ToggleMediaRichTextBlockTableTextBlock
    • "drop": zorgt ervoor dat dit element onmiddellijk wordt verwijderd wanneer er onbekende elementen worden aangetroffen. Het onbekende element komt niet hoger naar boven.

height

Geeft de hoogte van het element op.

  • Typ: BlockElementHeight
  • Versie: 1.1
  • Vereist: Nee
  • Toegestane waarden:
    • "auto": De hoogte van de container wordt bepaald door de hoogte van de inhoud.
    • "stretch": De container zal zijn hoogte tot de beschikbare resterende hoogte van de bovenliggende container uitbreiden.

scheidingsteken

Wanneer true, tekent u een scheidingslijn bovenaan het element.

  • Typ: boolean
  • Vereist: Nee

Afstand

Hiermee bepaalt u de hoeveelheid afstand tussen dit element en het voorgaande element.

  • Typ: Spacing
  • Vereist: Nee
  • Toegestane waarden:
    • "default", , "none""small", "medium", , "large", , "extraLarge""padding"

identiteitskaart

Een unieke id die is gekoppeld aan het item.

  • Typ: string
  • Verplicht: Nee

isVisible

Als false, zal dit item worden verwijderd uit de visuele boom.

  • Typ: boolean
  • Versie: 1.2
  • Vereist: Nee, standaard: true

Vereist

Een reeks sleutel-/waardeparen die aangeven welke functies het item nodig heeft met de bijbehorende minimale versie. Wanneer een functie ontbreekt of een onvoldoende versieniveau heeft, wordt fallback geactiveerd.

  • Typ: Dictionary<string>
  • Versie: 1.2
  • Vereist: Nee