https://github.com/deans-bradley/promptly
A modern C# library for building beautiful and interactive console applications with styled menus, input validation, progress indicators, and more.
https://github.com/deans-bradley/promptly
console csharp dotnet input-validation library menu progress-bar terminal ui
Last synced: 2 months ago
JSON representation
A modern C# library for building beautiful and interactive console applications with styled menus, input validation, progress indicators, and more.
- Host: GitHub
- URL: https://github.com/deans-bradley/promptly
- Owner: deans-bradley
- License: other
- Created: 2025-07-17T09:40:22.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-09-23T20:59:20.000Z (10 months ago)
- Last Synced: 2025-10-13T09:24:43.171Z (9 months ago)
- Topics: console, csharp, dotnet, input-validation, library, menu, progress-bar, terminal, ui
- Language: C#
- Homepage:
- Size: 31.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Promptly
A modern, feature-rich C# library for building beautiful and interactive console applications with ease.
## Overview
Promptly is a comprehensive toolkit designed to simplify console application development in C#. It provides a clean, organized set of utilities for creating professional-looking menus, handling user input, displaying progress indicators, and managing console output with style.
## Features
- **Interactive Menus**: Create styled menus with customizable appearance, disabled options, and flexible navigation
- **Input Validation**: Robust input handling with type-safe readers and validation utilities
- **Progress Indicators**: Multiple animation styles including dots, spinners, and progress bars
- **Message System**: Colored output messages with support for success, warning, and error states
- **Utility Functions**: Common console operations like screen clearing, confirmations, and pause prompts
## Installation
[](https://www.nuget.org/packages/Promptly/)
### .NET CLI
```bash
dotnet add package Promptly
```
### NuGet Package Manager
```bash
Install-Package Promptly
```
### PackageReference (Manual)
Add this to your `.csproj` file:
```xml
```
**Package URL**: https://www.nuget.org/packages/Promptly/
## Quick Start
```csharp
using Promptly.UI;
using Promptly.Output;
using Promptly.Input;
using Promptly.Utilities;
namespace MyConsoleApp
{
class Program
{
static void Main(string[] args)
{
Common.ClearScreen("Welcome to My App");
int choice = Menu.Show("Main Menu", new[]
{
"Start Process",
"View Settings",
"Help"
});
switch (choice)
{
case 1:
MessageWriter.WriteSuccess("Process started!");
ProgressIndicator.ShowLoader("Processing");
break;
case 2:
MessageWriter.WriteMessage("Opening settings...");
break;
case 3:
MessageWriter.WriteMessage("Help documentation...");
break;
case 0:
MessageWriter.WriteMessage("Goodbye!");
return;
}
Common.Continue();
}
}
}
```
## Documentation
### Menu System
#### Basic Menu
```csharp
int choice = Menu.Show("Choose an option", new[] { "Option 1", "Option 2", "Exit" });
```
#### Styled Menu with Configuration
```csharp
MenuConfig config = new()
{
Style = MenuStyle.Boxed,
TitleColor = ConsoleColor.Cyan,
AllowEscape = true
};
int choice = Menu.Show("Settings Menu", options, config);
```
#### Advanced Menu with Descriptions
```csharp
MenuOption[] options =
[
new("Process Data", "Processes the uploaded data files"),
new("Generate Report", "Creates a summary report"),
new("Advanced Settings", "Configure advanced options") { IsEnabled = false }
];
int choice = Menu.Show("Advanced Menu", options);
```
### Input Handling
#### Basic Input
```csharp
string name = InputReader.ReadInput("Enter your name: ");
string age = InputReader.ReadInt("Enter your age: ", 1, 120);
string email = InputReader.ReadRequiredInput("Enter email: ");
```
#### Input Validation
```csharp
if (InputValidator.IsValidEmail(email))
{
MessageWriter.WriteSuccess("Valid email address!");
}
```
### Progress Indicators
#### Simple Loader
```csharp
ProgressIndicator.ShowLoader("Loading data");
```
#### Spinner Animation
```csharp
ProgressIndicator.ShowSpinner("Connecting to server", 3000);
```
#### Progress Bar
```csharp
for (int i = 0; i <= 100; i++)
{
ProgressIndicator.ShowProgressBar(i, 100);
Thread.Sleep(50);
}
```
### Message Output
#### Colored Messages
```csharp
MessageWriter.WriteSuccess("Operation completed successfully!");
MessageWriter.WriteWarning("This action cannot be undone.");
MessageWriter.WriteError("Connection failed. Please try again.");
```
### Utility Functions
#### Screen Management
```csharp
Common.ClearScreen("Application Header");
Common.Continue(); // Press any key to continue
```
#### User Confirmation
```csharp
if (Common.Confirm("Are you sure you want to delete this file?"))
{
// Perform deletion
}
```
## Configuration Options
### Menu Styles
- `MenuStyle.None` - No styling
- `MenuStyle.Simple` - Simple separator lines
- `MenuStyle.Boxed` - Unicode box characters
- `MenuStyle.Minimal` - Minimal styling with underlines
### Progress Styles
- `ProgressStyle.Dots` - Animated dots
- `ProgressStyle.Spinner` - Rotating spinner
- `ProgressStyle.Bar` - Progress bar with percentage
- `ProgressStyle.Percentage` - Percentage only
### Message Types
- `MessageType.Info` - Standard information
- `MessageType.Success` - Success notifications
- `MessageType.Warning` - Warning messages
- `MessageType.Error` - Error notifications
## Requirements
- .NET 9.0 or later
- C# 10.0 or later
## Project Structure
```
Promptly/
├── Models/
│ └── MenuOption.cs
├── UI/
│ ├── Menu.cs
│ └── MenuStyles.cs
├── Input/
│ ├── InputReader.cs
│ └── InputValidator.cs
├── Output/
│ ├── MessageWriter.cs
│ └── ProgressIndicator.cs
└── Utilities/
└── Common.cs
```
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
## Author
**Bradley Deans**
GitHub: [@deans-bradley](https://github.com/deans-bradley)
## Contributing
This project is currently closed to contributions. However, feel free to fork the repository for your own use and modifications.
## Changelog
### Version 1.0.4
- Fix icon packaging path issue for NuGet package
- Add Promptly icon to package
### Version 1.0.3
- Add Promptly icon to `.csproj`
- Initial release with core functionality
- Menu system with multiple styling options
- Input validation and handling
- Progress indicators and animations
- Message output with color support
- Common utility functions