Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/IeuanWalker/Maui.Switch
Simple control to create custom switches in .NET MAUI
https://github.com/IeuanWalker/Maui.Switch
accessibility custom maui maui-apps nuget switch toggle toggle-switches
Last synced: 3 months ago
JSON representation
Simple control to create custom switches in .NET MAUI
- Host: GitHub
- URL: https://github.com/IeuanWalker/Maui.Switch
- Owner: IeuanWalker
- Created: 2022-12-04T12:09:42.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-05-09T15:14:48.000Z (6 months ago)
- Last Synced: 2024-07-10T17:03:27.560Z (4 months ago)
- Topics: accessibility, custom, maui, maui-apps, nuget, switch, toggle, toggle-switches
- Language: C#
- Homepage:
- Size: 5.08 MB
- Stars: 82
- Watchers: 4
- Forks: 6
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
- awesome-dotnet-maui - Switch - square)](https://github.com/IeuanWalker/Maui.Switch/stargazers)|[![GitHub last-commit](https://img.shields.io/github/last-commit/IeuanWalker/Maui.Switch?style=flat-square)](https://github.com/IeuanWalker/Maui.Switch/commits) (UI)
- awesome-maui - Switch - [![GitHub issues](https://img.shields.io/github/issues/IeuanWalker/Maui.Switch)](https://github.com/IeuanWalker/Maui.Switch) [![GitHub stars](https://img.shields.io/github/stars/IeuanWalker/Maui.Switch?style=flat-square)](https://github.com/IeuanWalker/Maui.Switch/stargazers) ![last commit](https://img.shields.io/github/last-commit/IeuanWalker/Maui.Switch?style=flat-square) - A control that allows you to design any type of switch/ toggle for .NET MAUI. It's also 100% accessible. (UI / Get Started)
README
| :memo: | This is a MAUI version of my [Xamarin NuGet](https://github.com/IeuanWalker?tab=repositories&q=switch&type=&language=&sort=) |
|---------------|:------------------------|# Maui.Switch [![Nuget](https://img.shields.io/nuget/v/IeuanWalker.Maui.Switch)](https://www.nuget.org/packages/IeuanWalker.Maui.Switch) [![Nuget](https://img.shields.io/nuget/dt/IeuanWalker.Maui.Switch)](https://www.nuget.org/packages/IeuanWalker.Maui.Switch)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![Build](https://github.com/IeuanWalker/Maui.Switch/actions/workflows/build.yml/badge.svg)](https://github.com/IeuanWalker/Maui.Switch/actions/workflows/build.yml)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FIeuanWalker%2FMaui.Switch.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2FIeuanWalker%2FMaui.Switch?ref=badge_shield)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/e27a4d0f0b92409283583e65ffc7e10b)](https://app.codacy.com/gh/IeuanWalker/Maui.Switch/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)This is a switch/ toggle control that would allow you to create any style switch you'd like.
This component is built on top/ from this great libary - https://github.com/Phenek/Global.InputForms. Fixes a few issues, adds more options for styling and improved accessibility.Take a look at the demo app included within this project -
![Sample App](Doc/SampleApp.gif)
## 1. How to use it?
Install the [NuGet package](https://www.nuget.org/packages/IeuanWalker.Maui.Switch) into your shared project project
```
Install-Package IeuanWalker.Maui.Switch
```Then in the `MauiProgram.cs` file, and the using statement -
```csharp
using IeuanWalker.Maui.Switch;
```
And call `.UseSwitch()` on `MauiAppBuilder` -
```csharp
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp()
.UseSwitch()
```## 2. Choose a control
This control contains 2 seperate controls, `CustomSwitch` and `SwitchView`.Essentially `CustomSwitch` allows you to design the induvidual parts of the switch, and the control handles all the logic for animating and changing the switch between the true/ false states
`SwitchView` gives you a blank canves to design any type of switch you want. It gives you the standard properties of a switch and makes it completely accessible.
Check the wiki guide for how to use them, and to view the examples -
- [CustomSwitch](https://github.com/IeuanWalker/Maui.Switch/wiki/CustomSwitch)
- [SwitchView](https://github.com/IeuanWalker/Maui.Switch/wiki/SwitchView)## 3. Accessibility
Both iOS and android see's this control as a native switch. So from an accessibility POV it behaves like a native switch.To make the switch even more accessible set the [`SemanticProperties.Hint`](https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/accessibility?view=net-maui-7.0#hint) property on the control, to let the user know what the switch is for.
## License
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FIeuanWalker%2FMaui.Switch.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2FIeuanWalker%2FMaui.Switch?ref=badge_large)