{"id":13713032,"url":"https://github.com/matteobortolazzo/HtmlLabelPlugin","last_synced_at":"2025-05-06T22:32:17.165Z","repository":{"id":21428004,"uuid":"92722256","full_name":"matteobortolazzo/HtmlLabelPlugin","owner":"matteobortolazzo","description":"Use this Xamarin.Forms plugin to display HTML content into a label.","archived":false,"fork":false,"pushed_at":"2022-12-30T07:30:38.000Z","size":1560,"stargazers_count":137,"open_issues_count":16,"forks_count":32,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-14T22:38:40.569Z","etag":null,"topics":["android","forms","html","ios","labels","uwp","xamarin","xamarin-forms","xamarin-plugin"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matteobortolazzo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-29T08:46:25.000Z","updated_at":"2024-03-21T11:27:40.000Z","dependencies_parsed_at":"2023-01-12T10:15:25.005Z","dependency_job_id":null,"html_url":"https://github.com/matteobortolazzo/HtmlLabelPlugin","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matteobortolazzo%2FHtmlLabelPlugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matteobortolazzo%2FHtmlLabelPlugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matteobortolazzo%2FHtmlLabelPlugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matteobortolazzo%2FHtmlLabelPlugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matteobortolazzo","download_url":"https://codeload.github.com/matteobortolazzo/HtmlLabelPlugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252779390,"owners_count":21802935,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","forms","html","ios","labels","uwp","xamarin","xamarin-forms","xamarin-plugin"],"created_at":"2024-08-02T23:01:26.302Z","updated_at":"2025-05-06T22:32:16.300Z","avatar_url":"https://github.com/matteobortolazzo.png","language":"C#","funding_links":[],"categories":["UI"],"sub_categories":[],"readme":"[![Build Status](https://dev.azure.com/matteobortolazzo/HtmlLabel/_apis/build/status/matteobortolazzo.HtmlLabelPlugin?branchName=master)](https://dev.azure.com/matteobortolazzo/HtmlLabel/_build/latest?definitionId=26\u0026branchName=master)\n[![Downloads](https://img.shields.io/nuget/dt/Xam.Plugin.HtmlLabel.svg)](https://www.nuget.org/packages/Xam.Plugin.HtmlLabel/)\n\n# HTML Label Plugin for Xamarin.Forms\nUse this Xamarin.Forms plugin to display HTML content into a label.\n\n## Setup\n* Available on [NuGet](https://www.nuget.org/packages/Xam.Plugin.HtmlLabel)\n* Install it in every Xamarin.Forms project.\n* **iOS**: AppDelegate.cs\n    ```cs\n    HtmlLabelRenderer.Initialize();\n    global::Xamarin.Forms.Forms.Init();\n    ```\n* **Android**: MainActivity.cs\n    ```cs\n    HtmlLabelRenderer.Initialize();\n    global::Xamarin.Forms.Forms.Init(this, bundle);\n    ```\n* **UWP**: App.xaml.cs\n    ```cs\n    var rendererAssemblies = new[] { typeof(HtmlLabelRenderer).GetTypeInfo().Assembly };\n    Xamarin.Forms.Forms.Init(e, rendererAssemblies);\n    HtmlLabelRenderer.Initialize();\n    ```      \n\n## How it works\nOn iOS and Android it uses the native HTML rendering capabilities of iOS's UILabel and Android's TextView. \n\nUWP's TextBlock cannot renders HTML so the library parses the HTML and uses Inlines to display: `\u003ca\u003e, \u003cb\u003e, \u003cbr\u003e, \u003cem\u003e, \u003ci\u003e, \u003cp\u003e, \u003cstrong\u003e, \u003cu\u003e, \u003cul\u003e \u003cli\u003e, \u003cdiv\u003e`.\n\nFontAttributes, FontFamily, FontSize, TextColor, HorizontalTextAlignment are converted into inline CSS in a wrapping `\u003cdiv\u003e` for iOS and Android. UWP supports them natively.\n\n## Custom styling\nIf you need to customize something in Android or iOS you can use inline CSS, for example: \n\n`\u003cspan style=\"color: green\"\u003e...\u003c/span\u003e`\n\nFor underlined text use the \u0026lt;u\u0026gt; tag:\n`\u003cu\u003eSome underlined text\u003c/u\u003e`\n\n**For links**: remember to add the schema (http:// https:// tel:// mailto:// ext...)\n\n**WARNING**: not all styles are supported by each platform!\n\n## Supported Properties\n* Text\n* FontAttributes\n* FontFamily\n* FontSize\n* TextColor\n* HorizontalTextAlignment\n* LineHeight (iOS, UWP)\n* UnderlineText\n* LinkColor\n* BrowserLaunchOptions\n* AndroidLegacyMode\n\n## Events\nNavigating\nNavigated\n\n## Usage XAML\n\n```xaml\nxmlns:htmlLabel=\"clr-namespace:LabelHtml.Forms.Plugin.Abstractions;assembly=HtmlLabel.Forms.Plugin\"\n\u003chtmlLabel:HtmlLabel Text=\"{Binding HtmlString}\"/\u003e\n```\n\n## Usage C#\n\n```csharp\nvar label = new HtmlLabel();\nlabel.Text = \"..htmlstring..\"\n```\n\n## Links\nIt is possible to customize *links*: \n* Color\n* Underline\n* Browser options\n\n[*Browser options*](https://docs.microsoft.com/en-us/xamarin/essentials/open-browser) are applied with the following schemas: *http*, *https*, *mailto*, *tel*, *sms* and *geo*.\n\n**WARNING**: This project uses [Xamarin.Essentials](https://docs.microsoft.com/en-us/xamarin/essentials/) to provide native *Email*, *Phone Dial*, *SMS* and *Maps* support. Please check the [getting started](https://docs.microsoft.com/en-us/xamarin/essentials/get-started) page.\n\n**iOS WARNING**: Changing the style of iOS links is not supported by *iOS* intentionally and this plugin use a workaround. From *Apple*:\n\u003e To promote consistency, the intended behavior is for ranges that represent links (specified via NSLinkAttributeName) to be drawn using the default link appearance.\n\n**UWP WARNING**: The minimum target for UWP is *17763*. If set to an older version, it won't find the assembly.\n\n## Android's Legacy Mode\nSettings the property `AndroidLegacyMode` to *True* the renderer separates block-level elements with blank lines.\n\n## Limitations\n\n* XF Label's TextType=\"HTML\" disables this implementation.\n* Adding *GestureRecognizers* will disabled links.\n* List of Android's supported tags [here](https://developer.android.com/guide/topics/resources/string-resource.html#FormattingAndStyling).\n\n### Contributions\nContributions are welcome!\n\n### License\nUnder MIT, see LICENSE file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatteobortolazzo%2FHtmlLabelPlugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatteobortolazzo%2FHtmlLabelPlugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatteobortolazzo%2FHtmlLabelPlugin/lists"}