{"id":37044521,"url":"https://github.com/fenrisdotio/fenris.oneofcontrib.blazor","last_synced_at":"2026-06-29T10:00:55.471Z","repository":{"id":219206767,"uuid":"747391283","full_name":"fenrisdotio/Fenris.OneOfContrib.Blazor","owner":"fenrisdotio","description":"A collection of Blazor components for working with OneOf discriminated unions","archived":false,"fork":false,"pushed_at":"2024-07-12T02:41:44.000Z","size":238,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-22T21:49:21.046Z","etag":null,"topics":["blazor","c-sharp","discriminated-unions","oneof"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/Fenris.OneOfContrib.Blazor","language":"HTML","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/fenrisdotio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-01-23T20:45:56.000Z","updated_at":"2025-07-17T12:54:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"a769f168-569c-43de-b52b-bf6ccd4585e8","html_url":"https://github.com/fenrisdotio/Fenris.OneOfContrib.Blazor","commit_stats":null,"previous_names":["fenrisdotio/fenris.oneofcontrib.blazor","fenrisdotio/oneof.extensions.blazor"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/fenrisdotio/Fenris.OneOfContrib.Blazor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fenrisdotio%2FFenris.OneOfContrib.Blazor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fenrisdotio%2FFenris.OneOfContrib.Blazor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fenrisdotio%2FFenris.OneOfContrib.Blazor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fenrisdotio%2FFenris.OneOfContrib.Blazor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fenrisdotio","download_url":"https://codeload.github.com/fenrisdotio/Fenris.OneOfContrib.Blazor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fenrisdotio%2FFenris.OneOfContrib.Blazor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34921807,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-29T02:00:05.398Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["blazor","c-sharp","discriminated-unions","oneof"],"created_at":"2026-01-14T05:09:00.801Z","updated_at":"2026-06-29T10:00:55.450Z","avatar_url":"https://github.com/fenrisdotio.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# Fenris.OneOfContrib.Blazor\n\nA collection of Blazor components for working with [OneOf](https://github.com/mcintyre321/OneOf) types in your Blazor\nproject.\n\n## 🤔 Why?\n\nI was working on a project where I needed to render different components based on the value of a `OneOf`.\nI couldn't get the `OneOf.Switch()` method to work in Blazor, and writing `switch` statements over and over again\nwas annoying and looked messy.\n\nInstead I made a component library, which is actually just a switch statement in disguise,\nand found it made my Blazor components much more readable and in general nicer to work with.\n\n## ⭐ Features\n\n- Blazor components for `OneOf` types with up to **8** type parameters.\n- Blazor components for types that inherit from `OneOfBase`, also with up to **8** type parameters.\n\nThat's it. It's a pretty simple library 😁\n\n## 💿 Installation\n\nInstall the [Fenris.OneOfContrib.Blazor](https://www.nuget.org/packages/Fenris.OneOfContrib.Blazor/) NuGet package.\n\n```bash\ndotnet add package Fenris.OneOfContrib.Blazor\n```\n\n## 🚀 Usage\n\nSee the [Examples](examples/OneOfContrib.Blazor.Examples/Pages/Index.razor) project for a full, simple example.\n\nLet's make a small example where we have to deal with a `OneOf\u003cstring, int\u003e`.\n\nFirst, add the using either to your `_Imports.razor` file, or directly in your specific pages/components:\n\n```csharp\n@using Fenris.OneOfContrib.Blazor.Components\n```\n\nThen use the component in your blazor pages or components\n\n```csharp\n\u003cOneOfSwitch2 Value=\"myOneOf\"\u003e\n    \u003cT0Template\u003e\n        \u003cp\u003eIt's a string and the value is @context!\u003c/p\u003e\n    \u003c/T0Template\u003e\n    \u003cT1Template\u003e\n        \u003cp\u003eIt's an int and the value is @context!\u003c/p\u003e\n    \u003c/T1Template\u003e\n\u003c/OneOfSwitch2\u003e\n\n@code {\n    private OneOf\u003cstring, int\u003e myOneOf = \"Hello World!\";\n}\n```\n\nIf you are using a `OneOfBase` type, you need to use the `\u003cOneOfBaseSwitch2\u003e` component instead. Everything else is\nidentical.\n\nIf your union contains more than two types, you need to use the `\u003cOneOfSwitchN\u003e` or `\u003cOneOfBaseSwitchN\u003e` components,\nwhere `N` is the number of types in your union. E.g. `\u003cOneOfSwitch5\u003e`\n\n## 🐛 Bugs, feature requests, and contributions\n\nIf you find a bug or have a feature request, please open an issue.\n\nPull requests are also welcome 😊\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffenrisdotio%2Ffenris.oneofcontrib.blazor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffenrisdotio%2Ffenris.oneofcontrib.blazor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffenrisdotio%2Ffenris.oneofcontrib.blazor/lists"}